control statments quiz

control statments quiz

University

9 Qs

quiz-placeholder

Similar activities

Tanda1_FUNPRO_IZI

Tanda1_FUNPRO_IZI

University

10 Qs

Functions

Functions

University

14 Qs

Variables and Functions

Variables and Functions

KG - University

10 Qs

CSC126_Chapter3.1

CSC126_Chapter3.1

University

10 Qs

FEWD Review

FEWD Review

University

12 Qs

Проверим, что мы помним!

Проверим, что мы помним!

University

8 Qs

Kuiz Dasar Python

Kuiz Dasar Python

University

10 Qs

Python Quiz

Python Quiz

3rd Grade - Professional Development

11 Qs

control statments quiz

control statments quiz

Assessment

Quiz

Created by

jaya mulimani

Computers

University

3 plays

Hard

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

8.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What should be the value of the variables num1 and num2 in the code below if the output expected is 4?

num1=?

num2=?

while(num1>=2):

    if(num1>num2):

        num1=num1/2

    else:

        print(num1)

        break

 

12, 5

8, 2

16, 6

16, 2

9.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which among the following codes have equivalent logic?

Code 1:

if(value3>1000 and value3<1006):

  if(value1=="ABC"):

    if(value2=="A"):

      value4=10

    else:

      value4=8

  elif(value1=="XYZ"):

    if(value2=="A"):

      value4=8

    else:

      value4=6

print(value4)

 Code 2:

if(value3>=1001 and value3<=1005 and value1=="ABC"):

    if(value2=="A"):

        value4=10

    else:

        value4=8

elif(value3>1000 and value3<1006 and value1=="XYZ"):

     if(value2=="A"):

        value4=8

     else:

        value4=6

print(value4)

Code 3: 

if(value3>1000 and value3<1006 or value1=="ABC"):

   if(value2=="A"):

      value4=10

   else:

      value4=8

elif(value3>1000 and value3<1006 or  value1=="XYZ"):

   if(value2=="A"):

      value4=8

   else:

      value4=6

print(value4)

Code 2, Code 3

Code 1, Code 3

Code 1, Code 2

None