Mastering Python Control Structures

Mastering Python Control Structures

University

20 Qs

quiz-placeholder

Similar activities

Weekly Assignment APP - Viva

Weekly Assignment APP - Viva

University

20 Qs

Soal Latihan Blockly kelas 8

Soal Latihan Blockly kelas 8

8th Grade - University

23 Qs

Mastering Python Control Flow

Mastering Python Control Flow

University

15 Qs

2F-3 | Python Quiz | 22/11/2024

2F-3 | Python Quiz | 22/11/2024

University

20 Qs

Java Basics Quiz for CH/PT Students

Java Basics Quiz for CH/PT Students

University

16 Qs

Python_MCQ_2

Python_MCQ_2

University

15 Qs

do while , for, Arrays

do while , for, Arrays

University

16 Qs

placement g2 quiz-1

placement g2 quiz-1

University

15 Qs

Mastering Python Control Structures

Mastering Python Control Structures

Assessment

Quiz

Information Technology (IT)

University

Hard

Created by

Junel Ventura

Used 3+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: if 5 > 3: print('True') else: print('False')?

False

Maybe

Not Sure

True

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct syntax for an if statement in Python?

if (condition) do_something

if condition: do_something

if: condition do_something

if condition do_something;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code: x = 10; if x < 5: print('Low'); elif x < 15: print('Medium'); else: print('High')?

High

Low

Very High

Medium

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Python, which operator is used for logical AND in conditions?

not

||

and

&&

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following expression: True and False?

True

False

Neither True nor False

False and True

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: if 10 > 5: print('A'); if 10 < 5: print('B')?

C

A

B

D

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of a chained if statement?

if (condition1) { // code } else { // code }

if (condition1) { // code }

if (condition1) { // code } else if (condition2) { // code } else { // code }

if (condition1) { // code } else if (condition2) { // code } else if (condition3) { // code }

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?