
Procedures
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Hard
Ms Seccafico
Used 99+ times
FREE Resource
Enhance your content in a minute
6 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the following procedure, the parameter str is a string and the parameter num is a number.
PROCEDURE printArgs(str, num)
{
DISPLAY(num)
DISPLAY(str)
DISPLAY(num)
}
Consider the following code segment.
printArgs("**", 1)
printArgs("*", 2)
What is displayed as a result of executing the code segment?
1 * 1 2 ** 2
1 ** 1 2 * 2
* 1 * ** 2 **
** 1 ** * 2 *
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following procedures.
PROCEDURE proc1(str)
{
DISPLAY(str)
DISPLAY("happy")
}
PROCEDURE proc2(str1, str2)
{
proc1(str2)
DISPLAY(str1)
}
What is displayed as a result of the procedure call proc2("birthday", "to you") ?
birthday happy to you
birthday happy birthday
to you birthday happy
to you happy birthday
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following procedure.
PROCEDURE doSomething(num1, num2)
{
DISPLAY(num1)
RETURN(num1)
DISPLAY(num2)
}
Consider the following statement.
DISPLAY(doSomething(10, 20))
What is displayed as a result of executing the statement above?
10 10
10 20
10 10 20
10 20 10
4.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Which of the following are benefits of procedural abstraction?
Select two answers.
Procedural abstraction prevents programmers from accidentally using the intellectual property of other programmers.
Procedural abstraction eliminates the need for programmers to document their code.
Procedural abstraction makes it easier for people to read computer programs.
Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
A student is developing a program that allows users to look up the definitions of words that appear in a book.
The student plans to perform a large number of searches through a dictionary containing words and their definitions. The student will use a procedure written by a computer scientist to quickly search the dictionary (and knows that the procedure will return a definition if one is available). The student cannot modify the search procedure written by the computer scientist but can call the procedure by supplying a word.
Which of the following is a true statement about the student’s use of the computer scientist’s search procedure?
The student is changing the search procedure’s internal abstractions.
The student is modifying the search procedure to take a definition as an argument and return the corresponding word.
The student is reusing the computer scientist’s procedural abstraction by knowing what the procedure does without knowing how it does it.
The student is reusing the computer scientist’s procedural abstraction by using duplicate code each time a search needs to occur.
6.
MULTIPLE CHOICE QUESTION
1 min • 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
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
CHƯƠNG TRÌNH CON BT1
Quiz
•
10th - 12th Grade
10 questions
R082 Book Cover Assets planning
Quiz
•
7th - 12th Grade
10 questions
Hệ Điều Hành Của Máy Tính
Quiz
•
10th Grade - University
10 questions
Treasure Hunt
Quiz
•
12th Grade
10 questions
Scratch (28th March)
Quiz
•
KG - University
10 questions
Initial Assessment - Cybersecurity Awareness
Quiz
•
9th Grade - Professio...
11 questions
Cyber Security Solutions
Quiz
•
9th - 12th Grade
10 questions
Greetings
Quiz
•
1st Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
