Week 2

Week 2

University

18 Qs

quiz-placeholder

Similar activities

Christmas Quiz KS3

Christmas Quiz KS3

6th Grade - University

16 Qs

R STARTER

R STARTER

University

20 Qs

Python Quiz_Module2

Python Quiz_Module2

University

20 Qs

Compile Error Set  4

Compile Error Set 4

University

20 Qs

Python workshop day2

Python workshop day2

University

20 Qs

Day-3 Assessment(Essentials of Data Analytics Using R)

Day-3 Assessment(Essentials of Data Analytics Using R)

University

15 Qs

Functions

Functions

University

15 Qs

Season 4 #Spaic Python Weekly Quiz

Season 4 #Spaic Python Weekly Quiz

KG - Professional Development

20 Qs

Week 2

Week 2

Assessment

Quiz

Other

University

Hard

Created by

Zamart Ramazanova

Used 17+ times

FREE Resource

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the result of the condition passed in the if block in Python?

“Boolean Output”

”Numeical Output”

”Both based on the scenaio”

”None of these”

Answer explanation

In Python, the condition in an if block evaluates to a Boolean output (True or False). Therefore, the correct answer is 'Boolean Output'.

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of following is not a decision-making statement?

if-elif statement

for statement

if -else statement

if statement

Answer explanation

This is a looping statement, not a decision-making statement. It is used to iterate over a sequence, such as a list, tuple, or range.

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What keyword would you use to add an altenative condition to an if statement?

else if

elseif

elif

None of the above

Answer explanation

Media Image
  • The elif keyword stands for "else if" and allows you to check additional conditions after an initial if statement.

  • If the if condition evaluates to False, Python checks the condition provided in the elif statement.

  • This structure helps handle multiple conditions in a clean and efficient way.

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which statement will check if a is equal to b?

if a = b:

if a == b:

if a === c:

if a == b

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

In python which of the following operator is used after condition of if statement?

Semicolon (;)

Comma (,)

Colon (:)

Dot (.)

Answer explanation

Media Image

In Python, a colon (:) is used after the condition in an if statement to indicate the start of the code block that belongs to the if statement.

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Media Image

Which one of the following outputs will print on the console successfully? For the following code segment:

False True

True True

False

none of the above

Answer explanation

  1. Condition: 4 + 5 == 10

    • This evaluates to False because 4 + 5 = 9, not 10.

    • Therefore, the else block is executed, which prints "False".

  2. Outside the if-else block:

    • The statement print("True") is executed unconditionally, as it is not part of the if-else block.

Output:

The output printed on the console will be:

False
True

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Media Image

Predict the output of the following code:

ok

okok

no output

none of above

Answer explanation

Media Image

This is because and has higher precedence than or.

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?