1. What is the output of the code shown below ?
class
pass
x= Truth()
bool(x)
a. Pass
b. True
c. False
d. Error
Ans : True
2. Operators with the same precedence are evaluated in which manner ?
a. Left to Right
b. Right to Left
c. Can't say
d. None of the mentioned
Ans : Left to Right
3. Which one of the following have the highest precedence in the expression ?
a. Exponential
b. Addition
c. Multiplication
d. Parentheses
Ans : Parentheses
4. Which of the following operators has its associativity from right to left ?
a. +
b. //
c. %
d. **
Ans : **
5. Which of the following is the truncation division operator ?
a. /
b. %
c. //
d. |
Ans : //
6. What is the value of the following expression :
float (22//3+3/3)
a. 8
b. 8.0
c. 8.3
d. 8.33
Ans : 8.0
7. Which of the following represents the bitwise XOR operator ?
a. &
b. ^
c. |
d. !
Ans : ^
8. Bitwise _____ gives 1 if eitheer of the bits is 1 and 0 when both of the bits are 1 :
a. OR
b. AND
c. XOR
d. NOT
Ans : XOR
9. Which of the following expressions can be used to multiply a given number 'a' by 4 ?
a. a<<2
b. a<<4
c. a>>2
d. a>>4
Ans : a<<2
10. What is the value of the expression :
~100 ?
a. 101
b. -101
c. 100
d. -100
Ans : -101
11. Which of the following Boolean expressions is not logically equivalent to the other three ?
a. not (-6<0 or -6>10)
b. -6>=0 and -6<=10
c. not(-6<10 or -6==10)
d. not(-6>10 or -6==10)
Ans : not(-6>10 or -6==10)
12. 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
Ans : List is mutable && Tuple is immutable
13. What type of data is: arr = [(1,1),(2,2),(3,3)] ?
a. Array of tuples
b. Tuples of lists
c. List of tuples
d. Invalid type
Ans : List of tuples
14. Can tuple be used as dictionary key in python ?
a. True
b. False
c. Tuple is not used in python
d. None of the above
Ans : True
15. Which one of the following is mutable data type ?
a. Set
b. Int
c. Str
d. Tupl
Ans : Set
16. Which one of the following is immutable data type ?
a. List
b. Set
c. Int
d. Dict
Ans : Int
17. What is the maximum length of an identifier in python ?
a. 32
b. 31
c. 63
d. None of the above
Ans : None of the above
18. All keyword in python are in
a. Lowercase
b. Uppercase
c. Both uppercase & Lowercase
d. None of the above
Ans : Both uppercase & Lowercase
19. Which of these are keyword ?
a. In
b. Is
c. Assert
d. All of the above
Ans : All of the above
20. What is the output of the following code :
print 5//2
a. 2
b. 2.5
c. 2.0
d. Error
Ans : 2
0 Comments