Search Header Logo
IterationReview

IterationReview

Assessment

Presentation

Computers

KG - 2nd Grade

Practice Problem

Hard

Created by

Andres Rengifo

Used 1+ times

FREE Resource

25 Slides • 22 Questions

1

media

2

media

3

Multiple Select

What is the difference between the input() and print() functions?

1

Input allows the user to provide input to the program

2

Print displays the output to the user

3

Input is used for storing data

4

Print is used for calculations

4

media

5

Multiple Choice

What is the purpose of the 'else if' (elif) clause in Python?

1

To execute code when the 'if' condition is true

2

To execute code when the previous conditions are false

3

To terminate the loop

4

To define a new function

6

media

7

Multiple Choice

What is the formula used to calculate the area in the flowchart?

1

length + width

2

length - width

3

length * width

4

length / width

8

media

9

media

10

Multiple Choice

What does the term "selection" refer to in the context of flowcharts?

1

Selecting the symbols to use

2

Choosing the start and end points

3

Making a choice between two or more alternatives

4

Selecting the steps to include

11

media

12

media

13

Multiple Choice

What is the purpose of the flowchart shown in the image?

1

To illustrate a linear search algorithm

2

To show sandwich recipes

3

To explain programming iterations

4

To demonstrate a cooking process

14

media

15

Multiple Choice

Which of these statements are true or false? A selection is where a decision needs to be made in the code, usually done using an if statement. An iteration is where a section of a code is repeated a specific number of times. Iterations are rarely used in advanced programs.

1

True

2

False

3

Both statements are true

4

Both statements are false

16

media

17

Multiple Choice

What are the two types of iterations mentioned in the image?

1

Condition-controlled

2

Count-controlled

3

Random-controlled

4

Time-controlled

18

media

19

Multiple Choice

What type of iteration is represented in the flowchart?

1

Count-controlled iteration

2

Infinite iteration

3

Conditional iteration

4

Nested iteration

20

media

21

Multiple Choice

What is the purpose of the flowchart in the context of password creation?

1

To show how to create a password

2

To illustrate a condition-controlled iteration

3

To explain password security

4

To demonstrate error handling

22

media

23

Fill in the Blank

24

media

25

Multiple Choice

What is a count-controlled iteration in programming?

1

A loop that runs indefinitely

2

A loop that runs a fixed number of times

3

A loop that runs based on user input

4

A loop that runs until a condition is met

26

media

27

Multiple Choice

How can you use a `for` loop to print all even numbers from 2 to 10, inclusive?

1

`for i in range(2, 11, 2): print(i)`

2

`for i in range(2, 10): if i % 2 == 0: print(i)`

3

`for i in range(1, 10, 2): print(i+1)`

4

`for i in range(2, 10, 2): print(i)`

28

media

29

Multiple Choice

Create a loop that outputs all odd numbers between 20 and 30 (inclusive).

1

21, 23, 25, 27, 29

2

20, 22, 24, 26, 28

3

21, 23, 25, 27, 29, 30

4

20, 22, 24, 26, 28, 30

30

media

31

media

32

Multiple Choice

What is the purpose of the Boolean variable in the code provided?

1

To track homework completion

2

To store user input

3

To create an infinite loop

4

To print messages

33

media

34

Multiple Choice

What will be the output of the following code snippet? ```python count = 1 while count < 4: print("I am cool! 8") count += 1 print("New value of count", str(count)) ``` 1. I am cool! 8 New value of count 2 2. I am cool! 8 New value of count 3 3. I am cool! 8 New value of count 4 4. The loop will not execute.

1

The loop will not execute.

2

I am cool! 8 New value of count 2 I am cool! 8 New value of count 3 I am cool! 8 New value of count 4

3

I am cool! 8 New value of count 2

4

I am cool! 8 New value of count 3

35

media

36

Multiple Choice

What are the two types of errors in programming?

1

Syntax errors

2

Logic errors

3

Runtime errors

4

Compilation errors

37

media

38

Multiple Choice

What are the two types of errors mentioned in programming?

1

Syntax errors

2

Logic errors

3

Runtime errors

4

Compilation errors

39

media

40

Multiple Choice

A student has created a while loop which contains a logic error and syntax error. Identify the errors in the code.

1

Syntax Error: A colon is missing in the while statement.

2

Logic Error: I is incremented by 2 instead of 1.

3

No errors present in the code.

4

The while loop is not structured correctly.

41

media

42

Multiple Choice

Create a program which continuously asks the user to enter an even number. If one is entered, the program ends. Hint: Use Boolean values.

1

A program that asks for odd numbers

2

A program that ends immediately

3

A program that asks for even numbers

4

A program that does not use loops

43

media

44

Multiple Choice

What is the purpose of the for loop in the given code?

1

To check each element in a list

2

To create a list of fruits

3

To print the elements in reverse order

4

To search for elements systematically

45

media

46

Multiple Select

Which of these statements are true or false? A while loop runs until the condition becomes False. A for loop can iterate over elements of a sequence like a list or a string. The range() function is commonly used in for loops for numeric iterations.

1

A while loop runs until the condition becomes False.

2

A for loop can iterate over elements of a sequence like a list or a string.

3

The range() function is commonly used in for loops for numeric iterations.

4

None of the above.

47

Poll

How confident do you feel about this topic now?

Very confident
Somewhat confident
Not confident
media

Show answer

Auto Play

Slide 1 / 47

SLIDE