MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Tells the interpreter that the code which follows is a function
A
const
B
int
C
def
D
while
Explanation: 

Detailed explanation-1: -def is the keyword for defining a function. The function name is followed by parameter(s) in (). The colon : signals the start of the function body, which is marked by indentation. Inside the function body, the return statement determines the value to be returned.

Detailed explanation-2: -When Python parses the def statement, it decides if the code is defining a generator or a function. If the code contains a yield expression, then it is a generator. So when the generator function a is called, it returns a generator object, b . The code inside the def statement is not executed until b.

Detailed explanation-3: -Explanation: Functions are defined using the def keyword.

Detailed explanation-4: -Which of the following functions is a built-in function in python? Explanation: The function seed is a function which is present in the random module. The functions sqrt and factorial are a part of the math module. The print function is a built-in function which prints a value directly to the system output.

There is 1 question to complete.