0% found this document useful (0 votes)
13 views

worksheet Python Revision Tour-1

The document contains a series of multiple-choice questions, fill-in-the-blanks, true/false questions, and assertions related to Python programming concepts. Topics covered include variable naming, data types, operators, expressions, and control flow statements. It serves as a revision tool for assessing knowledge of Python syntax and functionality.

Uploaded by

Parv Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

worksheet Python Revision Tour-1

The document contains a series of multiple-choice questions, fill-in-the-blanks, true/false questions, and assertions related to Python programming concepts. Topics covered include variable naming, data types, operators, expressions, and control flow statements. It serves as a revision tool for assessing knowledge of Python syntax and functionality.

Uploaded by

Parv Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Python Revision Tour

Multiple Choice Questions

Question 1
Which of the following is an invalid variable?

1. my_day_2
2. 2nd_day
3. Day_two
4. _2

Question 2
Find the invalid identifier from the following:

1. name
2. break
3. section
4. mark12

Question 3
Which of the following is not a keyword?

1. eval
2. assert
3. nonlocal
4. pass

Question 4
Which of the following cannot be a variable?

1. _init_
2. in
3. it
4. on

Question 5
Which of these is not a core data type?

1. Lists
2. Dictionary
3. Tuples
4. Class

Question 6
How w ould you write xy in Python as an expression ?
1. x^y
2. x**y
3. x^^y
4. none of these

Question 7
What will be the value of the expression?
14 + 13 % 15

1. 14
2. 27
3. 12
4. 0

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

1. 0.0
2. 0
3. 1.0
4. 1

Question 9
What is the value of x?
x = int(13.25 + 4/2)

1. 17
2. 14
3. 15
4. 23

x = int(13.25 + 4/2)

Question 10
The expression 8/4/2 will evaluate equivalent to which of the following expressions:

1. 8/(4/2)
2. (8/4)/2

Question 11
Which among the following list of operators has the highest precedence?
+, -, **, %, /, <<, >>, |

1. <<, >>
2. **
3. I
4. %

Question 12
Which of the following expressions results in an error?

1. float('12')
2. int('12')
3. float('12.5')
4. int('12.5')

Question 13
Which of the following statement prints the shown output below?
hello\example\test.txt

1. print("hello\example\test.txt")
2. print("hello\\example\\test.txt")
3. print("hello\"example\"test.txt")
4. print("hello"\example"\test.txt")

Question 15
Which two operators can be used on numeric values in Python?

1. @
2. %
3. +
4. #

Question 16
Which of the following four code fragments will yield following output?
Eina
Mina
Dika
Select all of the function calls that result in this output

1. print('''Eina
\nMina
\nDika''')
2. print('''EinaMinaDika''')
3. print('Eina\nMina\nDika')
4. print('Eina
Mina
Dika')

1. print('''Eina
\nMina
\nDika''') — It is a multiline string and by adding \n extra line will be
added.

Question 17
Which of the following is valid arithmetic operator in Python :

1. //
2. ?
3. <
4. and

Question 18
For a given declaration in Python as s = "WELCOME", which of the following will be the
correct output of print(s[1::2])?

1. WEL
2. COME
3. WLOE
4. ECM

Question 19
Which of the following is an incorrect Logical operator in Python?

1. not
2. in
3. or
4. and

Question 20
Which of the following is not a Tuple in Python?

1. (1,2,3)
2. ("One","Two","Three")
3. (10,)
4. ("One")

.
Fill in the Blanks

Question 1
The smallest individual unit in a program is known as a token.

Question 2
A token is also called a lexical unit.

Question 3
A keyword is
Question 3

A keyword is a word having special meaning and role as specified by programming language.

Question 4

The data types whose values cannot be changed in place are called immutable types.

Question 5

In a Python expression, when conversion of a value's data type is done automatically by the
compiler without programmer's intervention, it is called implicit type conversion.

Question 6

The explicit conversion of an operand to a specific type is called type casting.

Question 7

The pass statement is an empty statement in Python.

Question 8

A break statement skips the rest of the loop and jumps over to the statement following the
loop.

Question 9

The continue statement skips the rest of the loop statements and causes the next iteration of
the loop to take place.

Question 10

Python's keywords cannot be used as variable name.

True/False Questions

Question 1

The expression int(x) implies that the variable x is converted to integer.

Question 2

The value of the expressions 4/(3*(2 - 1)) and 4/3*(2 - 1) is the same.

= 1.33333

Question 3

The value of the expressions 4/(3*(4 - 2)) and 4/3*(4 - 2) is the same.
4/3*(4-2)
= 4/3*2
= 1.3333*2
= 2.6666

Question 4

The expression 2**2**3 is evaluated as: (2**2)**3.

Question 5

A string can be surrounded by three sets of single quotation marks or by three sets of double
quotation marks.

Question 6

Variables can be assigned only once.

Question 7

In Python, a variable is a placeholder for data.

Question 8

In Python, only if statement has else clause.

Question 9

Python loops can also have else clause.

Question 10

In a nested loop, a break statement terminates all the nested loops in one go.

Assertions and Reasons

Question 1

Assertion. Assigning a new value to an int variable creates a new variable internally.

Reason. The int type is immutable data type of Python.

Question 2

Assertion. """A Sample Python String""" is a valid Python String.

Reason. Triple Quotation marks are not valid in Python.


Question 3

Assertion. If and For are legal statements in Python.

Reason. Python is case sensitive and its basic selection and looping statements are in lower
case.

Question 4

Assertion. if and for are legal statements in Python.

Reason. Python is case sensitive and its basic selection and looping statements are in lower
case.

Question 5

Assertion. The break statement can be used with all selection and iteration statements.

Reason. Using break with an if statement is of no use unless the if statement is part of a
looping construct.

Question 6

Assertion. The break statement can be used with all selection and iteration statements.

Reason. Using break with an if statement will give no error.

You might also like