MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
This expression:x = 3x = x-1print(x)evaluates to
A
4
B
5
C
2
D
-1
Explanation: 

Detailed explanation-1: -The eval() function evaluates the specified expression, if the expression is a legal Python statement, it will be executed.

Detailed explanation-2: -What does the Python expression 3 * “A” evaluate to? a) It produces an error. Most simple computer programs follow the basic pattern defined by the acronym IPO, Input, Process, Output. When should you use a Python list to store your data?

Detailed explanation-3: -Explanation: The function len() returns the length of the number of elements in the iterable. Therefore the output of the function shown above is 4.

There is 1 question to complete.