Q. 1

How to swap two variables in one line ?

Options:

Explanation

Correct answer is : C

x, y = y, x
The y value will be assigned to x and x value to y in the left hand side

Discuss It

Q. 2

Is Python case sensitive while dealing with identifiers ?

Options:

Explanation

Correct answer is : A

Python is case sensitive

Test = 10
test = 15
print (Test) # prints 10
print (test) # prints 15

In this case Test and test are not the same

Discuss It

Q. 3

Which of the following is valid ?

Options:

Explanation

Correct answer is : D

The identifier can be declared using _ ( underscore ).
Note - __name__ is a build in identifier provided by the python interpreter, assigning value to it might cause issue

Discuss It

Q. 4

Which of the following is not a keyword?

Options:

Explanation

Correct answer is : B

max is not a keyword, but a built-in function

Discuss It

Q. 5

Which of the following is an invalid statement?

Options:

Explanation

Correct answer is : C

Spaces are not allowed in identifiers

Discuss It

Q. 6

What is the maximum possible length of an identifier or an attribute ?

Options:

Explanation

Correct answer is : D

Identifiers are unlimited in length.
But as per PEP 8 , you should imit all lines to a maximum of 79 characters for a better readability

Discuss It

Q. 7

Which of the following cannot be a variable ?

Options:

Explanation

Correct answer is : B

def is a keyword in python. Keywords can not be used as variable names

Discuss It

Q. 8

All keywords available in Python are in

Options:

Explanation

Correct answer is : C

Most of the python keywords are lowercase. Except few keywords like True, None

Discuss It

Q. 9

Which variable is invalid ?

Options:

Explanation

Correct answer is : B

Variable names can not start with integers

Discuss It

Q. 10

Which of the following is not a keyword?

Options:

Explanation

Correct answer is : B

open is a built in function used to handle the file operations like read, write

Discuss It
Submit Your Answers

Interview Questions

on
Variables

Tutorial

on
Variables

Programs

on
Variables
Click any Link
to navigate to certain page easily
Write a line to us
Your Email
Title
Description