
Pseudocode Quiz

Quiz
•
Computers
•
10th Grade
•
Easy
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
Similar Resources on Wayground
15 questions
Array

Quiz
•
10th - 12th Grade
12 questions
Arrays Intro

Quiz
•
9th - 12th Grade
15 questions
AV1/R1 3TEC_Banco de Dados - Chave Primária

Quiz
•
1st Grade - University
15 questions
Python Basics

Quiz
•
KG - University
10 questions
CODEHS Looping Unit 5 Review

Quiz
•
9th - 12th Grade
15 questions
Type data python

Quiz
•
9th Grade - University
10 questions
Bài tập trắc nghiệm C++

Quiz
•
3rd - 12th Grade
10 questions
ภาษาไพทอน

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade