Consider the code segment below.
If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
Question Type: Pseudocode
Quiz
•
Computers
•
10th - 12th Grade
•
Hard
Ahmet Ilbay
Used 73+ times
FREE Resource
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the code segment below.
If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
Better late than never.
Is anyone there?
Hello. Is anyone there?
Hello. Better late than never.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children attending the morning session, and the list afternoonList contains the names of all children attending the afternoon session.
Only children who attend both sessions eat lunch at the camp. The camp director wants to create lunchList, which will contain the names of children attending both sessions.
The following code segment is intended to create lunchList, which is initially empty. It uses the procedure IsFound (list, name), which returns true if name is found in list and returns false otherwise.
Which of the following could replace <MISSING CODE> so that the code segment works as intended?
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following program code.
Which of the following best describes the result of running the program code?
Nothing is displayed; the program results in an infinite loop.
The number 10 is displayed.
The number 6 is displayed.
The number 0 is displayed.
4.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
A teacher uses the following program to adjust student grades on an assignment by adding
5 points to each student’s original grade. However, if adding 5 points to a student’s original grade causes the grade to exceed 100 points, the student will receive the maximum possible score of 100 points. The students’ original grades are stored in the list gradeList, which is indexed from 1 to n.
Which of the following code segments can replace <MISSING CODE> so that the program works as intended?
Select two answers.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following code segment is intended to set max equal to the maximum value among the integer variables x, y and z. The code segment does not work as intended in all cases.
Which of the following initial values for x, y and z can be used to show that the code segment does not work as intended?
x = 1, y = 2, z = 3
x = 1, y = 3, z = 2
x = 2,, y = 3, z = 1
x = 3, y = 2, z = 1
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following procedure is intended to return the number of times the value val appears in the list myList. The procedure does not work as intended.
Which of the following changes can be made so that the procedure will work as intended?
Changing line 6 to IF(item = count)
Changing line 6 to IF(myList[item] = val)
Moving the statement in line 5 so that it appears between lines 2 and 3
Moving the statement in line 11 so that it appears between lines 9 and 10
7.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Consider the following procedure.
Which of the following code segments can be used to draw the figure?
8.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
In the following statement, val1, val2, and result are Boolean variables.
Which of the following code segments produce the same result as the statement above for all possible values of val1and val2 ?
10 questions
Comp Sci unit 3 #6
Quiz
•
11th Grade
12 questions
APCSA Unit 7
Quiz
•
9th - 12th Grade
10 questions
Comp Sci Unit 3 #11
Quiz
•
11th Grade
9 questions
Computer Science Review
Quiz
•
9th - 12th Grade
8 questions
CS A U1 Review
Quiz
•
12th Grade
13 questions
APCSP Final Exam Coding Practice
Quiz
•
9th - 12th Grade
10 questions
AP CSA Unit 1 & 2 Review
Quiz
•
9th - 12th Grade
10 questions
AP CSP-Review Session 1 MCQ Quiz
Quiz
•
10th 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