Pseudocode Quiz

Pseudocode Quiz

10th Grade

10 Qs

quiz-placeholder

Similar activities

Unit 6 Arrays

Unit 6 Arrays

10th - 12th Grade

14 Qs

AP CS A Unit 6 Quiz PRACTICE

AP CS A Unit 6 Quiz PRACTICE

9th - 12th Grade

10 Qs

CodeHS Concepts of Programming JavaScript

CodeHS Concepts of Programming JavaScript

9th - 12th Grade

15 Qs

Variables Java

Variables Java

10th - 12th Grade

15 Qs

COSC 1 Final

COSC 1 Final

9th - 10th Grade

15 Qs

C# Variables and Data Types

C# Variables and Data Types

8th Grade - University

9 Qs

Variables and Data Types

Variables and Data Types

10th - 12th Grade

10 Qs

19W Final Exam - PLTW

19W Final Exam - PLTW

9th - 12th Grade

15 Qs

Pseudocode Quiz

Pseudocode Quiz

Assessment

Quiz

Computers

10th Grade

Easy

Created by

John Streety

Used 2+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the pseudocode procedure findMaxDigit, which is intended to return the maximum digit in the integer num. For example, if num is 294, findMaxDigit returns 9 because 9 is the maximum digit in 294. // precondition: num is a positive integer greater than 0 int findMaxDigit (int num) int maxDigit ← /* missing code segment */ while (num > 0) int digit ← num % 10 if ( digit > maxDigit ) maxDigit ← digit end if num ← num / 10 //Division symbol uses integer division end while return maxDigit end findMaxDigit Which of the following could replace /* missing code segment */ so that findMaxDigit works as intended?

num / 10 + 10

num % 10

num * 10

num + 10

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following function: void drawTriangle () // print a line break after each print statement print "*" print "**" print "***" print "****" end drawTriangle What would happen as a result of calling drawTriangle()?

**********

* ** *** ****

*

****

**

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following pseudocode procedure. // precondition: k is a positive integer greater than 1 void mystery(int k) for (int c = 1; c < k; c = c + 1) print c + " " end for end mystery Which of the following best describes procedure mystery?

It returns all the values from 1 to k.

It returns all the values from 1 to k-1.

It prints all the values from 1 to k.

It prints all the values from 1 to k - 1.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following procedure and procedure call: void practice( int Y) int X ← 10 Y ← Y + 5 if ( X > Y) print “Hello” else print “world” end if end practice practice(5) What would print as a result of executing the code?

Nothing because the function is defined as VOID

Hello

Hello world

world

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following procedure header: int getSum(int num1, int num2, int num3) Which procedure call is valid?

getSum("A", 96, 95)

getSum(94.5, 96, 95)

getSum(96, 95)

getSum(getSum(92, 93, 95), 96, 95)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the pseudocode procedure swapValues that is intended to swap the values of the two integer variables m and n. void swapValues( int m, int n) /* missing code segment */ end swapValues Which of the following could replace /* missing code segment */ so that swapValues works as intended?

int temp ← m n ← m m ← n

int temp ← m m ← n n ← temp

int temp ← n m ← n n ← temp

int temp ← n n ← m m ← n

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following pseudocode procedure and procedure call: void practicePassing( pass-by-reference int X, pass-by-value int Y) Y = X / 2 // Division symbol uses integer division X = Y + 3 print X, Y end practicePassing Int i = 2 Int j = 3 practicePassing( i, j) print i, j What would print as a result of executing the code?

4 1 4 3

4 1 2 3

6 1 6 3

4 1 2 1

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?