1045 week 4

1045 week 4

University

5 Qs

quiz-placeholder

Similar activities

24-08-2021-Python-Tuples- Q & A - IB

24-08-2021-Python-Tuples- Q & A - IB

University

7 Qs

Quiz on Sequences and Comprehensions in Python

Quiz on Sequences and Comprehensions in Python

University

10 Qs

codestorm

codestorm

University

10 Qs

Data mining#Similarity-measures

Data mining#Similarity-measures

University

10 Qs

Q2 - Python

Q2 - Python

University

10 Qs

Lec 5a - Repetition

Lec 5a - Repetition

11th Grade - University

10 Qs

FLAT UNIT1 S8

FLAT UNIT1 S8

University

10 Qs

RDBMS QUIZ 8.01.2021

RDBMS QUIZ 8.01.2021

University

5 Qs

1045 week 4

1045 week 4

Assessment

Quiz

Fun, Computers

University

Medium

Created by

Ajay Kanagendran

Used 6+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When should we use a while loop instead of a for loop?

When the intervals or incremental values are known.

When the condition required to be satisfied to exit loop are not obvious or uniform

Depends on my mood

They are both the same

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

If we want to iterate through a list of strings and only print string that start with "A" or "I", whats the best way to do it?

For loop

While loop

It can't be done

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does range(99,1,-2) return?

Syntax error since there's no for loop

A list of all numbers between 99 inclusive and 1 inclusive ([99,98,97,....,2,1])

A list of every second number between 99 inclusive and 1 inclusive ([99,97,95,....,5,3,1])

A list of every second number between 99 inclusive and 1 exclusive ([99,97,95,....,5,3])

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

qTuple = (1,2,3)

qTuple[1] = 11

print(qTuple)

What does the code above

(11,2,3)

(1,2,3), since tuples are immutable

Error since tuples are immutable

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

dict = {

"apple": "an apple a day, keeps the doctor away",

"cloud": "every cloud has a silver lining",

"sun": "as bright as the sun"

}

print(dict["appl"])

What's the output of the code above?

an apple a day, keeps the doctor away

Key error since the key does not exist

Null since the key does not exist