Search Header Logo

NTRC DAY 3 QUIZ

Authored by Nehal Wadhwani

Computers

6th - 8th Grade

Used 4+ times

NTRC DAY 3 QUIZ
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the purpose of an if statement in Python?

a) To declare a variable.

b) To create a loop.

c) To define a function.

d) To make decisions based on conditions.

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What will be the output of the following code?

x = 10

if x > 5:

print("x is greater than 5")

else:

print("x is not greater than 5")

x is greater than 5
x is not greater than 5
x is equal to 5
The code will throw an error

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which operator is used to check if two values are equal in an if statement?

==
=
is

!=

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the purpose of a for loop in Python?

To repeat a specific block of code a known number of times

To create a condition.

To create a function

To compare two values.

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the key difference between a for loop and a while loop?

A for loop is used only for arrays, while a while loop can be used for any type of data

A for loop is used only when we know the number of time to repeat code, a while loop is used to run a loop until a condition is met

A for loop can only iterate in ascending order, while a while loop can iterate in any order
A for loop can only be used with integers, while a while loop can be used with any type of data

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the purpose of the elif statement in Python?

To execute a block of code if the previous conditions were not true

It's used to end a loop.

To create a loop

It's a typo; there is no elif statement in Python.

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

In Python, a comment starts with the symbol ________.

#
//
/*
--

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?