Python Day 3

Python Day 3

University

15 Qs

quiz-placeholder

Similar activities

PHP Quiz 1

PHP Quiz 1

University

20 Qs

Control Statements - Java

Control Statements - Java

University

15 Qs

Q2 - Comp Vision

Q2 - Comp Vision

University

10 Qs

Quiz 4 Week 6 Repetition Structures (For)

Quiz 4 Week 6 Repetition Structures (For)

University

15 Qs

Computer Science Quiz 02

Computer Science Quiz 02

10th Grade - University

19 Qs

Week 6 Quiz

Week 6 Quiz

University

20 Qs

Code.org Control Structures

Code.org Control Structures

University

14 Qs

Java Programming

Java Programming

University

20 Qs

Python Day 3

Python Day 3

Assessment

Quiz

Computers

University

Medium

Created by

ABINAYA 2022-2026

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x = 5 if x < 10: print("Less than 10")

Less than 10 

No output

Syntax error 

None of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x = 15 if x < 10: print("Less than 10") else: print("10 or more")

Less than 10 

10 or more 

Syntax error 

None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? x = 20 if x < 10: print("Less than 10") elif x < 20: print("Less than 20") else: print("20 or more")

Less than 10 

. Less than 20 

20 or more 

. Syntax error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? for i in range(3): print(i)

0 1 2 

1 2 3

0 1 2 3

1 2

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? i = 0 while i < 3: print(i) i += 1

1 2 3

0 1 2

0 1 2 3

1 2

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When is the else block executed in an if-else statement?

Always

Only when the if condition is true

Only when the if condition is false

Only when there is an error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of an if statement in programming?

To repeat a block of code multiple times

To execute a block of code only if a specified condition is true

To exit a loop immediately

To define a function

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?