Procedures

Procedures

12th Grade

6 Qs

quiz-placeholder

Similar activities

Quiz on Array

Quiz on Array

11th - 12th Grade

10 Qs

Mar10 Quick Quiz

Mar10 Quick Quiz

KG - Professional Development

10 Qs

Microsoft Windows

Microsoft Windows

3rd - 12th Grade

10 Qs

Access - Lesson 14

Access - Lesson 14

9th - 12th Grade

10 Qs

Know thy Peer-to-Peer

Know thy Peer-to-Peer

12th Grade

10 Qs

Abhyudaya coding class -  Grade 7

Abhyudaya coding class - Grade 7

6th Grade - University

10 Qs

MIL March 8, 2023

MIL March 8, 2023

12th Grade

10 Qs

What would you do if...

What would you do if...

1st - 12th Grade

10 Qs

Procedures

Procedures

Assessment

Quiz

Computers

12th Grade

Practice Problem

Hard

Created by

Ms Seccafico

Used 99+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Media Image

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?