0% found this document useful (0 votes)
17 views3 pages

MCQ 1

The document contains a series of questions and answers related to Python programming concepts, including equality checks, statement execution order, block definitions, and conditional statements. It also includes code snippets with expected outputs for various scenarios. The questions cover fundamental aspects of Python syntax and logic.

Uploaded by

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

MCQ 1

The document contains a series of questions and answers related to Python programming concepts, including equality checks, statement execution order, block definitions, and conditional statements. It also includes code snippets with expected outputs for various scenarios. The questions cover fundamental aspects of Python syntax and logic.

Uploaded by

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

Which statement will check if a is equal to b?

if a = b:

if a == b:

if a === c:

if a == b

The order of statement execution in the form of top to bottom is known as construct.

alternate

sequence

flow of data

flow chart

In Python, …………………. defines a block of statements.

Block

loop

indentation

{}

Which one of the following is a valid Python if statement:

if a>=22;

if a >= 22:

if (a => 22:):

none of the above

What will be output after execution of the following code?

a=11

b=5

if(a//b==2):

print ("Yes")

else :

print("No")
2.5

Yes

No

21

What is the output of the following code?

if(‘p’ in ‘Python’):
print(‘P is present’,end=” “)
else:
print(‘Not present’)

P is present

P is present Not present

Not present

None of the above

What is the output of the following code?

x = 10
if x < 5:
print("x is less than 5")
elif x > 15:
print("x is greater than 15")
else:
print("x is between 5 and 15")

x is less than 5

x is greater than 15

x is between 5 and 15

None of the above

What is the output of the following code if age = 50?

if age > 40:

if age > 60:

print('Turning old')

else:
print('Middle age')

else:

print('Young age')

Turning old

Middle age

Turning old Middle age

Young age

Which of the following is true about the code below?

x=3

if (x > 2):

x = x * 2;

if (x > 4):

x = 0;

print(x)

x will always equal 0 after this code executes for any value of x
if x is greater than 2, the value in x will be doubled after this code executes
if x is greater than 2, x will equal 0 after this code executes

None of the above

If the condition is …………. , the statements of if block will be executed otherwise the statements in
the ……….. block will be executed

false, true

true, else

both options are true

Can’t say

You might also like