Search Header Logo

control statments quiz

Authored by jaya mulimani

Computers

University

Used 3+ times

control statments quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below code snippet? 

num1=100

num2=200

num3=6

if(5>=num3):

    if(num1>100 or num2>150):

        print("1")

elif(num1>=100 and num2>150):

    print("2")

else:

    print("3")

1

2

3

None of the above

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What should be the value of num1 and num2 to get the output as "1"?

if((num1/num2==5) and (num1+num2)>5):

    print("1")

elif((num1-num2)<=1 or (num1%num2)==0):

    print("2")

else:

    print("3")

num1=11, num2=2

num1=0, num2=5

num1=5, num2=1

num1=-10,num2=2

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is the output of the code given below?

a = -10

b = -200

c = 2000

d = 4000

if( a*b >=d):

    if(d>c):

        if(d%c!=0):

            print(11)

        else:

            print(22)

else:

    if(b/a >0):

        if(a<b or d%c!=0):

          print(33)

        else:

          print(44)

11

22

44

33

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How many times "executed" will be printed in the output?

for variable_1 in range(1,5,-1):

    print("executed")

0

5

1

4

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Predict the output of the following code snippet.

number=28

for num in range(25,30):

    if(number>num):

        print(num)

    else:

        print(num)

        break

a. 28

b. 25     26     27     28

c. 25     26     27

d. 25     26     27     28     29

a

b

c

d

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Predict the output of the following code snippet.

for num in 23, 45, 50, 65, 76, 90:

    if(num%5!=0):

        continue

    if(num%10==0):

        print(num, end=" ")

        continue

    if(num%3==0):

        print(num, end=" ")

45 50 90

45 50 65 90

45 90

23 76

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Predict the output of the following code snippet.

for number in 10,15:

    for counter in range(1,3):

        print(number*counter, end=" ")

10 20 15 30

10 20 30 15 30 45

10 15 20 30 30 45

10 15 20 30

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

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers