0% found this document useful (0 votes)
7 views2 pages

1.find The Correct Identifiers Out

The document contains a series of questions related to Python programming, including valid identifiers, keywords, print statements, error types, data types, and operators. It tests knowledge on syntax, core data types, and the behavior of random number generation in Python. Additionally, it addresses the return types of certain functions and the validity of various operators.

Uploaded by

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

1.find The Correct Identifiers Out

The document contains a series of questions related to Python programming, including valid identifiers, keywords, print statements, error types, data types, and operators. It tests knowledge on syntax, core data types, and the behavior of random number generation in Python. Additionally, it addresses the return types of certain functions and the validity of various operators.

Uploaded by

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

1.

Find the correct identifiers out of the following, which can be used for naming
Variable, Constants or Functions in a python program :
For, while, INT, NeW, del, 1stName, Add+Subtract, name1

2.Identify the invalid keyword in Python from the following:


(a) True (b) None (c) Import (d) return

3. Select all options that print "hello-how-are-you "


a) print(‘hello’, ‘how’, ‘are’, ‘you’)
b) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
c) print(‘hello-‘ + ‘how-are-you’)
d) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)

4. What error occurs when you execute? apple = mango


a) SyntaxError b) NameError c) ValueError d) TypeError

5.In order to store values in terms of key and value we use what core data type.
a) list b) tuple c) class d) dictionary
6. Evaluvate the following:
a)8 * 3 + 2**3 // 9 – 4 b) not(20>6) or (19>7)and(20==20)
c) 7 // 5 + 8 * 2 / 4 – 3 d) not True and False or True

7. Consider the following code and find out the possible output(s) from the options
given below. Also write the least and highest value that can be generated.
import random as r
print(10 + r.randint(10,15) , end = ‘ ‘)
print(10 + r.randint(10,15) , end = ‘ ‘)
print(10 + r.randint(10,15) , end = ‘ ‘)
print(10 + r.randint(10,15))
i) 25 25 25 21 iii) 23 22 25 20
ii) 23 27 22 20 iv) 21 25 20 24
8.What possible outputs(s) are expected to be displayed on screen at the time of
execution of the program from the following code? Also specify the maximum values
that can be assigned to each of the variables first, second and third.
from random import randint
LST=[5,10,15,20,25,30,35,40,45,50,60,70]
first = randint(3,8)
second = randint(4,9)
third = randint(6,11)
print(LST[first],"#", LST[second],"#", LST[third],"#")
(i) 20#25#25# (ii) 30#40#70# (iii) 15#60#70# (iv) 35#40#60#

9. Identify the Errors from the following code fragmentation


30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
10. Which value type does input () return?
(a) Boolean (b) String (c) Int (d)Float

11) Which of the following is valid arithmetic operator in Python:


(i)in (ii) != (iii) & (iv) %

12) Which of the following is valid logical operator in Python:


(i) not in (ii) = (iii) << (iv) //

13) Which value type does bool () return?


(a) Boolean (b) String (c) Int (d)Float

14) Which of the following is valid membership operator in Python:


(i) and (ii) not (iii) is (iv) in

You might also like