Problem Solving and Python Programming: UNIT II: Data Types, Expressions, Statements

Multiple Choice Questions

Data Types, Expressions, Statements | Problem Solving and Python Programming

Engineering Python : UNIT II : Data Types, Expressions, Statements : Anna University Multiple Choice Questions & Answers

Multiple Choice Questions

Q. 1 Who developed Python language?

a. Zim Den

b. Niene Stom I

c. Bjarne Strousstrup

d. Guido Van Rossum

Ans : d. Guido Van Rossum

 

Q. 2 In which language Python is written?

a. PHP

b. Java

c. C

d. None of these

Ans : c. C

 

Q. 3 Which one of the following is the extension to the python file?

a. ру

b. python

c.pyt

d. .txt

Ans : a. ру

 

Q. 4 Which of the following statement is correct?

i) Python is a high level programming language.

ii) Python is an interpreted language

iii) Python is a compiled language.

iv) Python program is compiled before it is interpreted.

a. i, ii

b. i,iv

c. ii, iii

d. All of these

Ans : b. i,iv

 

Q. 5 What do we use to define a block of code in Python language?

a. Key

b. brackets

c. Indentation

d. All of these

Ans : c. Indentation

 

Q. 6 Which character is used to make single line comment ?

a. #

b. $

c. @

d. //

Ans : a. #

 

Q. 7 All keyword in python are in _

a. lowercase

b. uppercase

c. both uppercase and Lowercase

d. none of the above

Ans : c. both uppercase and Lowercase

 

Q. 8 Which of the following is incorrect variable name in Python ?

a. x _ 1

b. x1

c. 1x

d. _x

Ans : c. 1x

 

Q. 9 Which of the following is not relational operator in Python ?

a. =

b. > =

c. < =

d. ! =

Ans : a. =

 

Q. 10 Which one of the following has highest precedence in expression?

a. Addition

b. Subtraction

c. Exponentiation

d. Parenthesis

Ans : d. Parenthesis

 

Q.11 What is the maximum possible length of identifier ?

a. 32 characters

b. 63 characters

c. 79 characters

d. 31 characters

Ans : d. 31 characters

 

Q. 12 Which of the following is not a Python's predefined data type?

a. List

b. Tuple

c. Dictionary

d. class

Ans : d. class

 

Q. 13 Which of the following is a floor division?

a. /

b. //

c. %

d. %%

Ans : b. //

 

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

>>>51/2

a. 2

b. 2.5

c. 1

d. None of these

Ans : a. 2

 

Q. 15 What is the output of the following?

>>> "9"+"23"

a. 6

b. 33

c. 123

d. error

Ans : c. 123

 

Q. 16 Which of the following arithmetic operator cannot be used for strings

a.  *

b. –

c. +

d. All of these

Ans : b. –

 

Q. 17 What is the output of print(math.pow(2,3)) ?

a. 8.0

b. 8

c. 6

d. None of these

Ans : a. 8.0

 

Q. 18 What will be the output of the following code ?

str = "1+2"

print("str")

a. 1+2

b. 3

c. str

d. None of these

Ans : c. str

 

Q. 19 What will be the output of below Python code ?

str1="India"

str2=str1.

replace('i','I')

print(str2)

a. india

b. IndIa

c. India

d. indIa

Ans : b. IndIa

 

Q. 20 What will following Python code return?

str1="Python is fun"

print(len(str1))

a. 11

b. 12

c. 13

d 14

Ans : c. 13

 

Problem Solving and Python Programming: UNIT II: Data Types, Expressions, Statements : Tag: Engineering Python : Data Types, Expressions, Statements | Problem Solving and Python Programming - Multiple Choice Questions