Check Your Progress 5
Check Your Progress 5
Check Your Progress 5
A. 25
B. 35
C. It will print error
D. None of the above
13. Which of the following is true for variable names in Python?
A. unlimited length
B. variable names are not case sensitive C. underscore and ampersand are the only two
special characters allowed
D. none of the mentioned
14. What error occurs when you execute the following Python Code snippet?
apple = mango
A. SyntaxError
B. NameError
C. ValueError
D. TypeError
15. 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators? a
=4
b = 11
print (a | b)
print (a >> 2)
A. 15, 1
B. 14, 1
C. 15, 2
D. 14, 2
16. What is the output of print(2 ** 3 ** 2)?
A. 64
B. 128
C. 256
D. 512
17. What is the output of the following assignment operator?
y = 10
x = y += 2
print(x)
A. 12
B. 10
C. SyntaxError
18. What is the output of following code? a = 100
b = 200
print (a and b)
A. 100
B. 200
C. True
D. False
19. Which of the following operators has the lowest precedence?
A. %
B. +
C. **
D. Not
E. and
20.Which of these is not a core data type?
A. Lists
B. Dictionary
C. Tuples
D. Class
21. What data type is the object below? L = [1, 23, ‘hello’, 1]
A. List
B. Dictionary
C. Tuple
D. Array
22. What will be the output of the following Python code?
str=”hello”
str[:2]
A. he
B. lo
C. olleh
D. hello
23. In python we do not specify types, it is directly interpreted by the
compiler. So, consider the following operation to be performed:
x = 13 ? 2
objective is to make sure x has a integer value, select all that appl
A. x = 13 // 2
B. x = int(13 / 2)
C. x = 13 % 2
D. all of the above
24. What is the result of print(type({}) is set)
A. True
B. False
25. What is the data type of print (type(10))?
A. float
B. integer
C. int
26. If we convert one data type to another, then it is called
A. Type Conversion
B. Type Casting
C. Both of the above
D. None of the above
27. In which data type, indexing is not valid?
A. List
B. String
C. Dictionary
D. None of the above
28. In which of the following data type duplicate items are not allowed?
A. list
B. set
C. dictionary
D. None of the above
29. Which statement is correct?
A. List is immutable && Tuple is mutable
B. List is mutable && Tuple is immutable
C. Both are mutable
D. Both are immutable
30. In a python program, a control structure:
A. Defines program-specific data structures
B. Directs the order of execution of the statements in the program
C. Dictates what happens before the program starts and after it terminates
D. None of the above
31. Which of the following is False regarding loops in python?
A. Loops are used to perform certain tasks repeatedly
B. While loop is used when multiple statements are to executed repeatedly until the given
condition becomes False
C. While loop is used when multiple statements are to executed repeatedly until the given
condition becomes True.
D. for loop can be used to iterate through the elements of lists.
32. We can write if/else into one line in python.
A. True
B. False
33. Given the nested if-else below, what will be the value x when the code executed
successfully?
A. 0
B. 4
C. 2
D. 3
34. What is the output of the following nested loop
A. 10 Chair
10 Table
20 Chair
20 Table
B. 10 Chair
20 Chair
10 Table
20 Table
35. What is the value of x?:
A. 101
B. 99
C. None of the above, this is an infinite loop
D. 100