Chapter 1: Revision Tour Python
Q1. Python was developed by _________
Q2. Which one of the following is a valid identifier?
a) @name
b) name
c) 123name
d) while
Q3. Which one of the following is an invalid identifier?
a) variable
b) name123
c) _name
d) name@123
Q4. Variable name= 'Ashish' and Name='Ashish' are same
a) True
b) False
Q5. A program is a set of ____________________ .
Q6. Python is ___________ programming language .
a) Platform independent
b) Complex
c) Object oriented programming
d) a and c
Q7. Python interpreter executes ___________ at a time.
a) one instruction
b) all the instruction
Q8. Python works in ____________
a) Interactive mode
b) Script mode
c) Shell mode
d) a and b both
Q9. An interactive mode is suitable for ___________
a) A few lines of code
b) For a large program
Q10. Python is _________ language
a) Interpreted
b) Complied
Q11. Python is a ______ sensitive language.
Q12. A variable can hold different ________ of value at
different times.
Q13. A variable in Python is defined when a _________ is
assigned to it.
Q14. Which one of the following is the correct way to define
a variable?
a) var = 5
b) int var = 5
c) 5 = var
d) All of these
Q15. The l-value is that occur on the ________ side of an
assignment.
Q16. A r-value is a value that appear on the ______ side of
an assignment.
Q17. What is the value of the a and b in the following
expression?
a = 10
b = 20
a, b = b , a
print(a, " " ,b)
a) 10 20
b) Error
c) 20 10
d) No output
Q18. What is the value of the a and b in the following
expression?
a , b = ( 1 , 2)
print( a, " " , b)
a) 1 2
b) Error
c) No output
Q19. An expression is a combination of ___________ and
______ .
Q20. A statement is an ____________ to the interpreter.
a) instruction
b) expression
Q21. Comments are ___________ by an interpreter.
a) flaged
b) ignored
Q22. A comment in Python begins with_________
a) #
b) @
c) '
d) '''
Q23. Comments are used to tell __________
a) what the code does
b) who has written the code.
Q24. Comments are helpful because they __________
a) tell what the code does
b) make it is easy to
understand the code.
Q25. Operators are used to _________ expressions
a) evaluate
b) build
Q26. Which of the following is not an arithmetic operators?
a) +
b) %
c) /
d) x
Q27. Which one of the following expression is evaluated as
2?
a) 5 // 2
b) 5 % 2
c) 5 / 2
Q28. Comparison operator ________ two values.
Q29. Which one of the following is not a comparison
operator?
a) =
b) >
c) <
d) ==
Q30. Which one of the following is True?
a) 3 > 2
b) 2 < 2
c) 3 != 3
d) 4 <= 3
Q31. Logical operators evaluate expressions as ______ or
______.
Q32. Which one of the following is True?
a) True and False
b) not True
c) False or False
d) False or True
Q33. Which one of the following is not evaluated to 5?
a)
x = 2
x += 3
print(x)
b)
x = 6
x -=1
print(x)
c) b
x = 5
x *= 1
print(x)
d)
x = 10
x //= 5
print(x)
Q34. Membership operators check the ___________ of an
element in a ______________.
Q35. Find the output of the following?
x = 1
x in [1,2,3,4]
a) True
b) False
Q36. Find the output of the following?
x= 5
x not in (1,2,3,5)
a) True
b) False
Q37. Identity operators compare if objects are referencing
the ___________ location.
Q38. Find the output of the following?
a = 2
b = 3.0
c = a + b
print(type(c))
a) <class 'float'>
b) <class 'int'>
Q39. Find the output of the following?
a = 2
b= float(a)
print(b)
a) 2
b) 2.0
Q40. Which of the following will result in error?
a) float('int')
b) float('21'+'43')
c) float('21+43')
Q41. What is the output of the following?
5 % 2
a) 1
b) 2
c) 0
d) None of these
Q42. What is the output of the following?
5 // 2
a) 2
b) 2.0
c) 2.5
d) 1
Q43. What is the output of the following?
5 / 2
a) 2
b) 2.0
c) 2.5
d) 1
Q44. What is the output of the following?
(2**2)**4
a) 16
b) 256
c) 64
d) 128
Q45. Find out the odd one?
a) =
b) =
c) <=
d) !=
Q46. What is the output of the following?
x = True
y = 1
x and y
a) 1
b) 0
Q47. What is the output of the following?
x = True
y = 0
x and y
a) 1
b) 0
Q48. x = 1 and x == 1 are same
a) True
b) False
Q49. Find the odd one out?
a) and
b) or
c) not
Q50. Is x = x+ 1 is same as x+=1
a) True
b) False
Q51. Which of the following is true?
a) True and True
b) False or False
c) not True
d) True and False
Q52. Find the output of the following?
x = 5
x//=5
a) True
b) False
c) 1
d) 0
Q53. Find the odd one out?
a) +=
b) %=
c) //=
d) +
Q54. Find the odd one out?
b) %=
c) ==
d) !=
Q55. Which of the following is not of number type?
a) integer
b) float
c) complex
d) string
Q56. Which of the following is not of sequence type?
a) string
b) list
c) tuple
d) dictionary
Q57. Find the output of the following?
print(math.ceil(5.2) ,"
" , math.ceil(-5.2) )
a) 5 ,-5
b) 6 ,- 5
c) 6 , 5
d) 5, -6
Q58. Find the output of the following?
print(math.floor(5.2), "
" , math.floor(-5.2) )
a) 5 , 6
b) 5, - 6
c) 6, -6
d) None of these
Q59. Find the output of the following?
print(math.trunc(5.2), "
" , math.trunc(-5.2))
a) 5 , -5
b) 5, 6
c) 6, -5
d) None of these
Q60. Find the output of the following?
math.pow(9,-1)
a) Error
b) .1111111
c) 9
d) None of these
Q61. Find the output of the following?
import math
print(math.sqrt(4) , math.sqrt(4.0))
a) 2, 2
b) 2, 2.0
c) 2.0, 2.0
d) 2.0, 2
Q62. The output of the math.log2(4) is _______
Q63. The output of the log10(100) is__________
Q64. Find the output of the following code
math.factorial(-1)
a) 0
b) -1
c) ValueError
d) None of these
Q65. Which one of the following is an incorrect declaration?
a) a,b,c = 1,2,3
b) a = b = c =1
c) _a = 3
d) 3 = x
Answer
Sheet- Chapter Revision Tour Python:
1.
Guido van Rossum
2. b
Explanation:
Keyword
cannot be used as an identifier
An
Identifier can start with a letter or underscore
An
Identifier can contain letters, underscores and numbers
3. d
4. b
Explanation:
Python
is a case sensitive language
5.
instructions
6. d
Explanation:
Python
can run on a variety of hardware platforms or software, hence it
is
Platform independent
7. a
Explanation:
An
interpreter executes one instruction at a time
8. d
9. a
10. a
11. case
12.
types
13.
value
14. a
Explanation:
5 =
var SyntaxError: can't assign to literal
int
var = 5 No need of define type, hence int is not required hence
answer
is option a
15.
left
16.
right
17. c
18. a
19.
operator, operands
20. a
21. b
22. a
23. a
24. b
25. a
26. d
27. a
28.
compare
29. a
30. a
31.
True or False
32. d
33. d
34.
existence, sequence
35. a
36. b
37.
memory
38. a
39. b
40. a
41. a
42. a
43. c
44. b
45. a
46. a
47. b
48. b
49. c
50. a
51. a
52. c
53. d
54. b
55. d
56. d
57. b
59. a
60. b
61. c
62.
2.0
63.
2.0
64. c
65. d
Explanation:
It is
a simultaneous assignment or tuple unpacking a, b, c = 1,2,3
It is
multiple assignment a = b = c =1
Assigning
value to variable _a = 3
It is incorrect because
it is not possible to assign value to a literal 3 = x

0 Comments