Chapter 3 – Introduction to Python
1. State True or False: Semicolon in Python is compulsory.
a. Ture
b. False
Ans: b. False
2. _____ is a logical unit of instructions to a Python interpreter
a. Statement
b. Block
c. Inline Comments
d. If else block
Ans: a. Statement
3. What is the output of “pow(6,2)”?
a. 36.0
b. 36
c. 64
d. 12.0
Ans: a. 36.0
4. What is the output of “log10(10000)”?
a. 2
b. 4
c. 3
d. 5
Ans: b. 4
5. Which of the following is not the built-in function?
a. log10 ()
b. pow()
c. int()
d. float()
e. Ans: a. log10 ()
6. What is called as string interpolation?
a. F-String
b. Byte Encoding
c. a + b (where “a”, and “b” are string variables)
d. Raw String
Ans: a. F-String
7. What is the output of ‘{1} in {0}’.format(‘Python’, ‘programing’)?
a. Python Programming
b. Python in Programming
c. Programming in Python
d. Programming Python
Ans: c. Programming in python
8. What is the syntax for the format method in strings?
a. format(value, specification)
b. Format(value, specification)
c. format(value)
d. format(value, access specifier)
e. Ans: a. format(value, specification)
9. Which of the following is not a part of the integer datatype?
a. %e
b. %E
c. %c
d. %u
Ans: d. %u
10. What is the escape character used for Carriage return?
a. \r
b. \t
c. \ooo
d. \xnn
11. What is the output of the following snippet?
print (“I am using Python”, end= “.”)
a. I am using Python.>>>
b. I am using Python.
c. I am using Python
d. I am using Python.
>>>
Ans: a. I am using Python.>>>
12. What is the output of the following snippet?
>>> a = 2
>>> print(a, " is one and only even prime number")
a. 2 is one and only even prime number
b. 2is one and only even prime number
c. Error Message
d. None of the above
Ans: a. 2 is one and only even prime number
13. What is the output of the following snippet?
>>> z = eval(5%5)
a. TypeError
b. 0
c. 1
d. Argument Mismatch
Ans: a. TypeError
14. What is the output datatype of the eval() function?
a. Integer
b. String
c. Character
d. Float
Ans: a. Integer
15. What is the output of “chr(97)”?
a. “a”
b. “b”
c. Error
d. “o”
Ans: a. “a”
16. Which of the following has the highest precedence operator?
a. Arithmetic Operator
b. Bitwise Operator
c. Assignment Operator
d. Logical Operator
Ans: a. Arithmetic Operator
17. What is the output of the statement “15>>2”?
a. 3
b. 5
c. 63
d. 30
Ans: a. 3
18. What is the output of “10|5” ?
a. 15
b. 10
c. 9
d. 20
Ans: a. 15
19. What is the value of 20 + (3+12) +2 ** 4?
a. 51
b. 5764801
c. 38416
d. 31
Ans: a. 51
20. ____ is an unordered collection of zero or more elements with no duplicates
a. Set
b. List
c. Tuple
d. Dictionary
Ans: a.Set