Python Quiz -2 (20 Questions)

Python Quiz -2 (20 Questions)

Python Quiz -2

1. The expression Int(x) implies that the variable x is converted to integer. State whether true or false.

2. Which one of the following has the highest precedence in the expression?

3. Which of these in not a core data type?

4. Given a function that does not return any value, What value is thrown by default when executed in shell

5. Following set of commands are executed in shell, what will be the output?
1. >>>str="hello"
2. >>>str[:2]
3. >>>

6. Which of the following will run without errors ?

7. What is the return type of function id?

8. In python we do not specify types,it is directly interpreted by the compiler, so consider the following operation to be performed.
1. >>>x = 13 ? 2
objective is to make sure x has a integer value, select all that apply (python 3.xx)

9. What error occurs when you execute?
apple = mango

10. Carefully observe the code and give the answer.
1. def example(a):
2. a = a + '2'
3. a = a*2
4. return a
5. >>>example("hello")

11. . What data type is the object below ?
L = [1, 23, ‘hello’, 1].

12. In order to store values in terms of key and value we use what core data type

13. Which of the following results in a SyntaxError ?

14. The following is displayed by a print function call:
1. tom
2. dick
3. harry
Select all of the function calls that result in this output

15. What is the average value of the code that is executed below ?
1. >>>grade1 = 80
2. >>>grade2 = 90
3. >>>average = (grade1 + grade2) / 2

16. What is the return value of trunc() ?

17. The value of the expression:
4 + 3 % 5

18. Evaluate the expression given below if A= 16 and B = 15.
A % B // A

19. Which of the following operators has its associativity from right to left?

20. What is the value of x if:
x = int(43.55+2/2)