McqMate
Chapters
1. |
Which of these in not a core data type? |
A. | lists |
B. | dictionary |
C. | tuples |
D. | class |
Answer» D. class | |
Explanation: class is a user defined data type. |
2. |
Given a function that does not return any value, What value is thrown by default when executed in shell. |
A. | int |
B. | bool |
C. | void |
D. | none |
Answer» D. none | |
Explanation: python shell throws a nonetype object back. |
3. |
Which of the following will run without errors? |
A. | round(45.8) |
B. | round(6352.898,2,5) |
C. | round() |
D. | round(7463.123,2,1) |
Answer» A. round(45.8) | |
Explanation: execute help(round) in the shell to get details of the parameters that are passed into the round function. |
4. |
What is the return type of function id? |
A. | int |
B. | float |
C. | bool |
D. | dict |
Answer» A. int | |
Explanation: execute help(id) to find out details in python shell.id returns a integer value that is unique. |
5. |
In python we do not specify types, it is
|
A. | x = 13 // 2 |
B. | x = int(13 / 2) |
C. | x = 13 % 2 |
D. | all of the mentioned |
Answer» D. all of the mentioned | |
Explanation: // is integer operation in python |
6. |
what will be the output of the following
|
A. | indentation error |
B. | cannot perform mathematical operation on strings |
C. | hello2 |
D. | hello2hello2 |
Answer» A. indentation error | |
Explanation: python codes have to be indented properly. |
7. |
What data type is the object below? L = [1, 23, 'hello', 1] |
A. | list |
B. | dictionary |
C. | array |
D. | tuple |
Answer» A. list | |
Explanation: list data type can store any |
8. |
In order to store values in terms of key and value we use what core data type. |
A. | list |
B. | tuple |
C. | class |
D. | dictionary |
Answer» D. dictionary | |
Explanation: dictionary stores values in terms of keys and values. |
9. |
Which of the following results in a SyntaxError? |
A. | ‘”once upon a time…”, she said.’ |
B. | “he said, ‘yes!\” |
C. | ‘3\\’ |
D. | ”’that’s okay”’ |
Answer» C. ‘3\\’ | |
Explanation: carefully look at the colons. |
10. |
What is the average value of the
|
A. | 85.0 |
B. | 85.1 |
C. | 95.0 |
D. | 95.1 |
Answer» A. 85.0 | |
Explanation: cause a decimal value of 0 to appear as output. |
11. |
What is the return value of trunc()? |
A. | int |
B. | bool |
C. | float |
D. | none |
Answer» A. int | |
Explanation: execute help(math.trunc) to get details. |
Done Reading?