Assignment 2(CIVIL)

Assignment 2(CIVIL)

University

25 Qs

quiz-placeholder

Similar activities

From Binary To Denary Conversion - IGCSE

From Binary To Denary Conversion - IGCSE

7th Grade - Professional Development

20 Qs

DWDM-2

DWDM-2

University

20 Qs

IGH Test de Entrada

IGH Test de Entrada

University

20 Qs

Relational Algebra and Calculus

Relational Algebra and Calculus

University

20 Qs

Artificial Intelligence CT-1

Artificial Intelligence CT-1

University

20 Qs

Micro Arch - CPUs & Fetch-Execute

Micro Arch - CPUs & Fetch-Execute

University

20 Qs

Cloud Review Quiz

Cloud Review Quiz

University

20 Qs

Pra UPS 2

Pra UPS 2

University

20 Qs

Assignment 2(CIVIL)

Assignment 2(CIVIL)

Assessment

Quiz

Computers

University

Hard

Created by

D. CSE2481

Used 2+ times

FREE Resource

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

1. What is the output of the following for loop and  range() function

for num in range(-2,-5,-1):

print(num, end=", ")

  • -2, -1, -3, -4

  • -2, -1, 0, 1, 2, 3,

  • -2, -1, 0

  • -2, -3, -4,

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the nested if-else structure below, what will be the value of x after code execution completes

x = 0

a = 0

b = -5

if a > 0:

if b < 0:

x = x + 5

elif a > 5:

x = x + 4

else:

x = x + 3

else:

x = x + 2

print(x)

2

0

3

4

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following range() function

for num in range(2,-5,-1):

print(num, end=", ")

  • 2, 1, 0

  • 2, 1, 0, -1, -2, -3, -4, -5

  • 2, 1, 0, -1, -2, -3, -4

  • 2, 1, 0, -1, -2

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following if statement

a, b = 12, 5

if a + b:

print('True')

else:

print('False')

  • False

  • True

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid conditional statement in Python?

if a = 5:

if a == 5:

if a <> 5:

if (a = 5):

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the outcome if the elif and else blocks are missing in an if statement?

Syntax error

he program will stop

Nothing, it's optional

Runtime error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

x = 10;
if x > 5:
print("Greater")

Error

Greater

Nothing

Less

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?