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

(A) - Init - (B) in (C) It (D) On

The document contains 15 multiple choice questions about Python syntax, variables, data types, and operators. It tests knowledge of valid print statements, case sensitivity, keywords, valid variables, data type returned by input(), operator precedence, representing integers, and arithmetic operators. It also provides a table on operator precedence from highest to lowest priority.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
481 views

(A) - Init - (B) in (C) It (D) On

The document contains 15 multiple choice questions about Python syntax, variables, data types, and operators. It tests knowledge of valid print statements, case sensitivity, keywords, valid variables, data type returned by input(), operator precedence, representing integers, and arithmetic operators. It also provides a table on operator precedence from highest to lowest priority.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment-I

Q.1 Which line of code has the correct syntax for the print statement?

(a) print(Its’ a rainy day) (b) Print(‘its’s a rainy day’)

(c) print(‘it’s a rany day’) (d) print(‘it\’s a rainy day’)

Q.2 Is python case sensitive when dealing with identifiers?


(a) yes (b)no (c) machine dependent (d) none of the mentioned above

Q.3 Which of the following is not a keyword?


(a) eval (b) assert (c) nonlocal (d) pass

Q.4 Which of the following is an invalid variable?


(a) my_day_2 (b) 2nd_day (c) Day_two (d) _2

Q.5 Which of the following cannot be a variable?


(a) _init_ (b) in (c)it (d) on

Q.6 Which two operators can be used on numeric values in python ?


(a) @ (b) % (c) + (d) #

Q.7 A Token is also called a ____________.

Q.8 how would you write Xy in python as an expression


(a) x^y (b) x**y (c)x^^y (d) None of these

Q.9 which value type does input() return ?


(a) Boolean (b) string (c) int (d) float
Operator precedence:
The following table show priority from highest to lowest.
Operator Description
()
** Exponentiation (raise to the power)
~ ,+, - Complement, unary plus and minus (method names for the last two
are +@ and -@)
*, / ,% ,// Multiply, divide, modulo and floor division
+, - Addition, subtraction
>>, << Right and left bitwise shift
& Bitwise And
^ ,| Bitwise exclusive `OR' and regular `OR'
<=, <, > ,>= Comparison operator
<>, ==, != Equality operator
=, %=, /=, //=, -=, += ,*=, **= Assignment operator
is , is not Identity operator
In, not in Membership operator
not or and Logical operator

Note:- if there are multiple Exponentiation(**) operator in an expression, then they are
evaluated from Right to Left.

Q. 10 what is the value of this expression , 3**3**1 ?


(a) 27 (b) 9 (c) 3 (d) 1

Q. 11 What is the output of the following code?


>>> a=2**(3**2)
>>>b=(2**3)**2
>>>c=2**3**2
>>>a,b,c

Q.12 How many ways are there in python to represent an integer literal?

Q.13 Write the type of tokens from the following:


(i) if (ii) roll_no
Q.14 Which of the following is valid arithmetic operator in Python?
(i) // (ii)? (iii)< (iv) and

Q.15 Write the names of any four data types in python?

You might also like