In the following procedure, the parameter str is a string and the parameter num is a number.
Consider the following code segment.
printArgs("**", 1)
printArgs("*", 2)
What is displayed as a result of executing the code segment?
Procedures Practice Part 2
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
David Guy
Used 28+ times
FREE Resource
6 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
In the following procedure, the parameter str is a string and the parameter num is a number.
Consider the following code segment.
printArgs("**", 1)
printArgs("*", 2)
What is displayed as a result of executing the code segment?
2.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
In the following procedure, the parameter age represents a person’s age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended.
Removing which two lines of code will cause the procedure to work as intended?
Select two answers.
Line 3
Line 8
Line 10
Line 15
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A student wrote the following procedure to calculate the sum of the integers from 1 to 5.
The student later decides to modify the procedure to calculate the sum of the integers from 1 to max, which represents any positive integer greater than 1.
Which of the following changes should be made to the procedure to meet the student’s goal?
I. The procedure should take max as an input parameter.
II. The condition in the REPEAT UNTIL block should be changed to count > max.
III. The condition in the REPEAT UNTIL block should be changed to max < 5.
I only
II only
I and II
I and III
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
The figure below shows a robot in a grid of squares. The robot is represented as a triangle, which is initially facing upward. The robot can move into a white or gray square but cannot move into a black region.
Consider the procedure MoveAndTurn below.
Which of the following code segments will move the robot to the gray square?
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A red triangle is pictured below in a grid of squares. It is currently facing upward, and can only move using the MoveTriangle procedure, shown below. The triangle can move onto white and gray squares, but not onto the black squares.
Which of the following instructions will get the red triangle to the gray square?
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Code for the procedure Enigma is shown below. Assume that the parameter n has been assigned a positive integer value.
Which of the following shows a possible result of calling the procedure?
10 questions
Alpha Task Code Quiz Check in
Quiz
•
9th - 12th Grade
10 questions
Spike Level 2
Quiz
•
8th - 12th Grade
10 questions
EV3 Level 2 Quiz
Quiz
•
7th - 12th Grade
11 questions
GCSE Computer Science Paper 2: Topic 2.2
Quiz
•
10th Grade
10 questions
Global and local variables
Quiz
•
10th - 12th Grade
8 questions
VEXcodeVR Unit 3 Formative
Quiz
•
12th Grade
8 questions
VEX VR Block Coding Unit 3 - Repeating Behavior
Quiz
•
9th - 12th Grade
7 questions
Algorithms Robots
Quiz
•
9th - 12th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University