Search Header Logo

Pseudocode Quiz

Authored by SREEDHAR YELLAM

Computers

Professional Development

Used 2+ times

Pseudocode Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

23 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the output of the following pseudocode be? def func(x): if x == 0: return 1 else: return x * func(x - 1) print(func(4))

0

24

10

120

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will the following pseudocode print? x = [1, 2, 3, 4] y = [a * 2 for a in x if a % 2 == 0] print(y)

[4, 8]

[2, 4, 6, 8]

[2, 6]

Error

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following pseudocode? def mystery(a, b): if b == 0: return a return mystery(b, a % b) print(mystery(8, 12))

1

4

8

12

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will this pseudocode output? def add_elements(arr): return sum(arr[i] for i in range(0, len(arr), 2)) print(add_elements([1, 2, 3, 4, 5, 6]))

9

12

15

18

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the result of the following pseudocode? x = "abcd" y = [i.upper() for i in x] print(y)

['A', 'B', 'C', 'D']

['abcd']

'ABCD'

Error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does this pseudocode print? def rotate_list(lst, n): return lst[n:] + lst[ ] print(rotate_list([1, 2, 3, 4, 5], 2))

[1, 2, 3, 4, 5]

[3, 4, 5, 1, 2]

[2, 3, 4, 5, 1]

[4, 5, 1, 2, 3]

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of this pseudocode? def check_string(s): return s[::-1] == s print(check_string("level"))

True

False

Error

level

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?