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

PythonQues&Ans Set1

Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

PythonQues&Ans Set1

Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1) What is the maximum possible length of an identifier?

a.16
b.32
c.64
d.None of these above
Ans: d.None of these above

2) Who developed the Python language?


a.Zim Den
b.Guido van Rossum
c.Niene Stom
d.Wick van Rossum
Ans: b.Guido van Rossum

3) In which year was the Python language developed?


a.1995
b.1972
c.1981
d.1989
Ans: d.1989

4) In which language is Python written?


a.English
b.PHP
c.C
d.All of the above
Ans:c.C

5) Which one of the following is the correct extension of the Python file?
a..py
b..python
c..p
d.None of these
Ans:a..py

6)What do we use to define a block of code in Python language?


a.Key
b.Brackets
c.Indentation
d.None of these
Ans:c.Indentation

8) Which character is used in Python to make a single line comment?


a./
b.//
c.#
d.!
Ans:c.#

9) Which of the following declarations is incorrect?


a._x = 2
b.__x = 3
c.__xyz__ = 5
d.None of these
Ans:d.None of these

10) Why does the name of local variables start with an underscore discouraged?
a.To identify the variable
b.It confuses the interpreter
c.It indicates a private variable of a class
d.None of these
Ans:c.It indicates a private variable of a class

11) Which of the following is not a keyword in Python language?


a.val
b.raise
c.try
d.with
Ans:a.val

12) Which of the following statements is correct for variable names in Python
language?
a.All variable names must begin with an underscore.
b.Unlimited length
c.The variable name length is a maximum of 2.
d.All of the above
Ans:b.Unlimited length

13) Which of the following declarations is incorrect in python language?


a.xyzp = 5,000,000
b.x y z p = 5000 6000 7000 8000
c.x,y,z,p = 5000, 6000, 7000, 8000
d.x_y_z_p = 5,000,000
Ans:b.x y z p = 5000 6000 7000 8000

14) Which of the following words cannot be a variable in python language?


a._val
b.val
c.try
d._try_
Ans:c.try

15) Which of the following operators is the correct option for power(ab)?
a.a ^ b
b.a**b
c.a ^ ^ b
d.a ^ * b
Ans:b.a**b

16) Which of the following precedence order is correct in Python?


a.Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
b.Multiplication, Division, Addition, Subtraction, Parentheses, Exponential
c.Division, Multiplication, Addition, Subtraction, Parentheses, Exponential
d.Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
Ans:a.Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

17) Study the following function:

all([2,4,0,6])
What will be the output of this function?
a.False
b.True
c.0
d.Invalid code
Ans:a.False

18) Which one of the following has the highest precedence in the expression?
a.Division
b.Subtraction
c.Power
d.Parentheses
Ans:a.Division

19) Which of the following functions is a built-in function in python language?


a.val()
b.print()
c.print
d.None of these
Ans:b.print()

20)Which of the following is correctly evaluated for this function?


pow(x,y,z)
a.(x**y) / z
b.(x / y) * z
c.(x**y) % z
d.(x / y) / z
Ans:c.(x**y) % z

You might also like