wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Question Bank for Grade 14 Computers

Total questions: 115

Worksheet time: 58mins

Name
Class
Date
1.

Which of the following are true statements about the binary search process? Check all that apply.

a)

The average case scenario Big O running time is O(log N).

b)

The target value must be contained within the list.

c)

The process checks the middle item for a match, and then looks to the right or to the left if it doesn't match, repeating this process until a match is found, or not.

d)

The precondition is that the list must be sorted.

2.

Which of the following is considered an O(N log N) class sort for a worst case scenario?

a)

Insertion Sort

b)

Merge Sort

c)

Selection Sort

d)

Quick Sort

3.

Which of these would be considered the worst case scenario for a linear search?

a)

The target value is not found in the list.

b)

The target value is found at the end of the list.

c)

The target value is found at the beginning of the list.

d)

The target value is found somewhere in the middle of the list.

4.

Consider a list that contains eight integer values. If the list is sorted using the merge sort, how many total division operations will take place during the entire process?

(a)  

5.

Which of the following describes a selection sort?

a)

The "best value for each position" is found and swapped into place with each pass.

b)

The list is partitioned around a pivot point.

c)

Unsorted values are shifted into their "best position" in the list.

d)

Adjacent values are compared and swapped if out of order.

6.

Which of the following descriptions of the Big O analysis categories is NOT correct?

a)

 

An O(N log N) process is characterized by a divide and conquer process combined with an N based loop.

b)

An O(N2) process is characterized by a nested loop process based on the size of the data set.

c)

An O(1) process only works on a data set of 100 items or less.

d)

An O(N) process is characterized by a loop that spans the entire data set of size N.

7.

Consider a list:

{ 3, 5, 8, 10, 14, 34, 78, 123, 513, 999 }

If a binary search for the value 34 is performed, how many comparison operations will be required to find it?

a)

3

b)

1

c)

6

d)

5

8.

Assume there is a function defined swap( pass-by-reference int [] list, int position1, int position2 ) which swaps values in the array list at index position1 and index position2. What sorting routine is represented by the code shown?

a)

Bubble

b)

Selection

c)

Merge

d)

Quick

e)

Insertion

9.

Consider a list:

{ 9, 2, 6, 8, -3, 7, 2, 15, 0, -1, 14, 99, -1 }

If a linear search for the value -1 is performed, what will be returned?

a)

10

b)

9

c)

12

d)

-1

10.

Consider a partially sorted list that is undergoing the insertion sort in ascending order, with the first four values already in sorted order:

{ 1, 5, 6, 7, 4, 2, 3 }

How many shifts must be performed to insert the value 4 into the correct position?

a)

2

b)

1

c)

4

d)

3

11.

Consider the following list:

{ 1, 6, 7, 4, 3, 9, 2, 5, 8 }

If the entire list is undergoing the initial partitioning pass using a quick sort process, with the middle value as the pivot, what will the list look like after the first pass?

a)

{ 1, 2, 3, 4, 7, 9, 6, 5, 8 }

b)

{ 1, 2, 7, 4, 3, 9, 6, 5, 8 }

c)

{ 1, 6, 4, 3, 7, 2, 5, 8, 9 }

d)

{ 1, 6, 7, 4, 3, 9, 2, 5, 8 }

12.

A sort algorithm finds the best place in an already sorted portion of the list for the next unsorted item. Which sort algorithm best fits this description?

a)

insertion sort

b)

merge sort

c)

selection sort

d)

quick sort

13.

Consider the following array, partially sorted using a selection sort process.

{ 0, 1, 2, 4, 5, 7, 3, 6 }

If elements have been correctly selected for the first three positions, what will the array look like after the next pass?

a)

{ 0, 1, 2, 3, 5, 7, 4, 6 }

b)

{ 0, 1, 2, 3, 5, 4, 6, 7 }

c)

{ 0, 1, 2, 3, 4, 5, 7, 6 }

d)

 

{ 0, 1, 2, 3, 5, 6, 4, 7 }

14.

Consider the following array:

{ 0, 1, 6, 4, 2}

In how many passes will an ascending order bubble sort be accomplished?

a)

5

b)

2

c)

3

d)

4

15.

Consider the partial pseudocode for a sort shown:

 

Which sort is this code most likely to represent?

a)

quick sort

b)

selection sort

c)

insertion sort

d)

merge sort

16.

Consider this partial pseudocode segment for a quick sort, given a lo and hi index representing the inclusive bounds of the partition to be sorted.

What is the purpose of the if statement in this pseudocode?

a)

The if statement detects that the entire list has been sorted and ends execution.

b)

The if statement detects a pivot value and returns it.

c)

The if statement detects new bounds of a partition and returns it.

d)

The if statement detects a section of the list that is too small to partition any further and ends execution for that part of the process.

17.

For a list of 1000 elements, using a process that is considered to have an O(log N) running time in all situations, what value below represents the maximum number of steps it will take for the algorithm to complete its task?

a)

1000

b)

10

c)

500

d)

1

18.

Which of the statements below is NOT correct regarding the class definition shown?

a)

The methods defined in lines 13 through 16 are accessor methods

b)

The method defined in lines 7 and 8 controls the construction of a StudentInfo object

c)

Lines 2 and 3 contain private instance field declarations

d)

The methods defined in lines 9 through 12 are mutator methods

19.

Using the class definition and client code shown above, which of the following is NOT a valid client code statement for line 20?

a)

print s.toString()

b)

print s.age

c)

s.setAge(24)

d)

print s.getAge()

20.

Which choice below best describes the situation where the running time of a binary search is O(1)?

a)

When the target value being searched is found in the middle of the list.

b)

When the target value being searched is not found.

c)

When the target value being searched is found at the beginning of the list.

d)

When the target value being searched is found at the end of the list.

21.

The adjacency matrix of a 4-node graph is given below. How many direct connection paths exist in the graph that is represented by this matrix?

(a)  

22.

Which choice below is best described by the following statement?

Linear data structure contained in static, contiguous memory, where all items can be easily assigned and accessed using an indexing process, allowing for quick and easy data management.

a)

Queue

b)

Stack

c)

Array

d)

Tree

e)

Graph

23.

After the integer elements 5, 3, 7, 1, 2, 4 are correctly inserted into a minimum heap tree, with the value 5 as the initial root, which choice below represents the pre-order traversal of the tree?

a)

1 2 3 4 5 7

b)

5 2 3 1 7 4

c)

5 3 2 7 4 1

d)

1 2 5 3 4 7

24.

After the integer elements 5, 3, 7, 1, 2, 4 are correctly inserted into a binary search tree, and the value 6 is then added to the tree, which statement below best describes the resulting position of the node that contains the 6?

a)

Left child of 1

b)

Root node

c)

Right child of 4

d)

Left child of 7

25.

If a linked list contains N elements, and only the head of the list is referenced, which statement below best describes how many steps it will take to insert another element at the back of the list?

a)

N/2 steps

b)

One step

c)

N*2 steps

d)

N steps

26.

What is output by the code shown below, where length represents the number of elements?

(a)  

27.

Which choices are true about one dimensional arrays? Check all that apply.

a)

An array can contain elements of different data types at the same time.

b)

Values are stored in contiguous memory.

c)

Values are accessed using an indexing process.

d)

Once an array has been created, it is static, and cannot grow or shrink in size.

28.

After the integer elements 5, 3, 7, 1, 2, 4 are correctly inserted into an ascending order binary search tree, what is the resulting in-order traversal? Fill in the blank with the correct sequence of digits with no spaces between.

(a)  

29.

What is output by the following code sequence?

(a)  

30.

What is output by the following code sequence?

(a)  

31.

Which choice below is best described by the following statement?

Data structure that resembles a waiting line in a cafeteria, where elements join the list at the back, and are accessed or removed from the list at the front.

a)

Tree

b)

Graph

c)

Stack

d)

Array

e)

Queue

32.

After the integer elements 5, 3, 7, 1, 2, 4 are correctly inserted into a minimum heap tree, with the value 5 as the initial root, and the value 6 added to the heap, which term or terms below best describes the resulting tree? Check all that apply.

a)

Full tree

b)

Balanced tree

c)

Complete tree

33.

Which choice below is best described by the following statement?

Data structure containing several nodes, often called vertices, which are connected to other nodes using edges, which can be directed or undirected.

a)

Linked List

b)

Queue

c)

Array

d)

Stack

e)

Graph

34.

What is output by the code shown?

a)

5

b)

6

c)

12

d)

2

35.
Question Image

Using the class definition and diagram shown, with the linked list at the top of the diagram referenced by Node p, match the statements provided in the correct sequence to correctly construct and insert the new node into the list, resulting in the list shown in the lower portion of the diagram.

a)

Node t = new Node()

1.

Line 1

b)

t.data = 7

2.

Line 2

c)

Node temp = p.next.next

3.

Line 3

d)

p.next.next = t

4.

Line 4

e)

t.next = temp

5.

Line 5

36.

Which choice is NOT true about two dimensional arrays

a)

Values are accessed using an indexing process, where the first index represents the column, and the second represents the row.

b)

The number of columns in each row can be different.

c)

Values are stored in contiguous memory.

d)

All elements contained in the array must be of the same data type.

37.

A special kind of queue is required where elements are inserted in natural ascending order, often called a priority queue. The element popped from the front of this queue is always the smallest item in the list. Which of the following data structures will best implement this requirement?

a)

 

Minimum Heap

b)

Array

c)

Linked List

d)

Binary Search Tree

38.

What is output by the code shown?

(a)  

39.

Which choice below is best described by the following statement?

Data structure containing several nodes, each of which can point to two other nodes, often referred to as children.

a)

Stack

b)

Queue

c)

Tree

d)

Array

e)

Linked List

40.

Which choice below is best described by the following statement?

Data structure where insertion or deletion of elements is restricted to only one end of the list.

a)

Array

b)

Graph

c)

Stack

d)

Queue

e)

Linked List

41.

A linear data structure required is to be flexible in size, where elements can be added and accessed anywhere in the list. Which of the following data structures meets these requirements?

a)

Linked List

b)

Array

c)

Tree

d)

Graph

e)

Stack

42.

Referring to graph illustration, which choices represent possible paths within the graph? Check all valid paths.

a)

BEABDC

b)

CBAEAC

c)

EADCBD

d)

ABEDBA

e)

DABEDC

43.

Using the class definition, diagram and partial code shown, which code segment will correctly replace <code> resulting in temp referencing the final node of the list? Check all that apply.

a)

temp.next != null

b)

temp.next == null

c)

temp != 5

d)

temp.data != 4

e)

temp != null

44.

What is the resulting array after the code segment shown below is executed? Write the answer in the blank in the exact format as shown in the bolded portion below, beginning with an open brace, listing elements separated by commas, no spaces between, ending with a closing brace.

(a)  

45.

Using the tree node class definition below, partial client code is shown for a inserting characters of the string "PETUNIA" into a binary search tree, resulting in the tree displayed. Which choice best replaces <code> to correctly insert the next node into the tree?

a)

root.right.left = temp

b)

root.left.left = temp

c)

root.left.right = temp

d)

root.right.right = temp

46.

Which of these terms refer to the general process of repeating code elements inside a program? Check all that apply.

a)

looping

b)

recursion

c)

sequence

d)

iteration

e)

branching

47.
Question Image

In the code segment shown, match each line with the term that best describes the code on that line.

a)

Start

1.

Line 1

b)

Step

2.

Line 2

c)

Check

3.

Line 3

d)

Action

4.

Line 4

48.

How many times can the start of a loop happen?

a)

More than four times

b)

Twice

c)

Four times

d)

Three times

e)

Once

49.

During the execution of the code segment shown, how many times does the "check" portion of the loop occur?

(a)  

50.

For the code segment shown, what is the last value printed?

(a)  

51.

List the values of the line numbers according to the sequence of the statements in the code segment below. List all digits in a row with no spaces between.

The answer will be begin with the digits 123 and end with 5.

(a)  

52.

Which <start>, <check> and <step> options in the choices below will cause the action of this loop to occur 10 times?

a)

int x ← 1 ; x < 10; x++

b)

int x ← 5 ; x < 33; x+= 3

c)

int x ← 0 ; x ≤ 10; ++x

d)

int x ← 1 ; x ≤ 10 ; x++

e)

int x ← 0 ; x < 10; ++x

53.

Which loop styles will ALWAYS act at least once?

a)

do while

b)

for

c)

while

d)

repeat until

54.

How many stars will be output by this loop?

a)

3

b)

None

c)

Infinitely many

d)

5

e)

4

55.

What is output by this pseudocode segment?

(a)  

56.

What is output by this pseudocode segment?

(a)  

57.

Which control structure listed below is the primary one used in a recursive method?

a)

if else statement

b)

Loop

c)

Sequential processing

d)

Switch statement

58.

Which of the terms listed represents the part of the recursive process that causes repetition?

a)

Loop

b)

Base case

c)

if else statement

d)

Recursive call

59.

Which of the terms listed represents the part of the recursive method that stops the repetitive process?

a)

Loop

b)

Base case

c)

Recursive call

d)

if else statement

60.

Which of the statements listed below are true regarding the use of loops and recursion? Check all that apply.

a)

Both loops and recursion are processes used to repeat tasks in a program.

b)

Loops are more memory efficient than recursive processes.

c)

Use a loop when possible, and only use recursion when a loop is not possible, or is less effective.

d)

There are some things a recursive process can do that a loop cannot or does with great difficulty.

61.

What is output by this pseudocode segment?

(a)  

62.

What is output by this pseudocode segment?

(a)  

63.

Which choice shows an input value for num to produce the output shown below?

a)

23

b)

21

c)

25

d)

27

64.

What statement best describes a value that could be input for x so the while loop shown below will never act?

a)

Any value except 23

b)

The value 23

c)

Any value greater than 23

d)

Any value less than 23

65.

How many times will the action statement happen in the loop shown?

(a)  

66.

Select all choices listed below that are within the next five values in this base 8 sequence.

5, 6, 7

a)

8

b)

13

c)

10

d)

11

e)

9

67.

Match each identifier shown with the most appropriate type of identifier category.

a)

variable

1.

name

b)

class

2.

Person

c)

constant

3.

VALUE

d)

method

4.

doSomething()

68.

Which choice best describes the stage in the software system life cycle which determines the structure of the software strategy and code?

a)

Design

b)

Maintenance

c)

Implementation (Coding)

d)

Testing

e)

Analysis

69.

Which of the choices listed represents the greatest value?

a)

11000111 base 2

b)

C3 base 16

c)

304 base 8

d)

196 base 10

70.

Which design process below is most appropriate for a project where the design team has taken the analysis and identified many processes already defined that can be used to develop the project, saving much time and effort.

a)

Stepwise refinement

b)

Bottom up

c)

Top down

d)

Object Oriented

71.

Which choice represents a development process combining features of other development models into a cyclical process, including several phases, one of which is risk analysis.

a)

Waterfall

b)

 

Spiral

c)

Incremental

d)

Agile

72.

A certain method of class A works in a certain way, but how this is accomplished is not known. Which choice best describes this situation?

a)

Polymorphism

b)

Composition

c)

Inheritance

d)

Encapsulation

e)

Abstraction

73.

The definition of an object in OOP, describing the type of data owned by the object, as well as methods that act on that data.

a)

object

b)

class

c)

method

d)

procedure

e)

function

74.

An aspect of object oriented programming incorporating related data items and methods into a class definition, including instance variables, constructors, accessor and modifer methods is often referred to as:

a)

Abstraction

b)

Polymorphism

c)

Composition

d)

Inheritance

e)

Encapsulation

75.

Classify each piece of data according to the choices given.

a)

char

1.

'e'

b)

double

2.

4.87

c)

String

3.

"Joe"

d)

boolean

4.

True

e)

int

5.

42

76.

What is the next value in this binary sequence?

101, 110, 111

(a)  

77.

Identify the data type for this value:

"G"

a)

 

String

b)

boolean

c)

int

d)

char

e)

float

78.

Which choice best describes the feature of OOP that allows for classes to be defined based on previously defined and developed classes, receiving all of the characteristics of the original class, and then expanding on those features, easily identified as an "is a" relationship.

a)

 

Polymorphism

b)

Encapsulation

c)

Inheritance

d)

Abstraction

e)

Composition

79.

Select the best choice describing a structured comment block indicating the expected output for a process.

a)

Postcondition

b)

External documentation

c)

Block comment

d)

Precondition

e)

Single line comment

80.

Choose the statement that best classifies the identifier creation guideline shown.

Contains only alphanumeric characters, or the underscore character

a)

Good idea

b)

Rule

c)

Convention

81.

If the character 'e' has an ASCII value of 101, what would be the sum of all the ASCII characters in the word "face"?

(a)  

82.

Polymorphsim means "many forms", a key element of object oriented programming, with three main characteristics. Match each description below to the appropriate characteristic.

a)

Polymorphic reference

1.

The instance of a parent class can point to any instances of its child classes

b)

Overloading

2.

A class defines several constructors for an object, each with a unique parameter signature

c)

Overriding

3.

An inherited method is redefined by the child class

83.

Which choice best describes the situation when a method of class F inherited from class G is redefined in a more special way?

a)

Polymorphism - polymorphic object

b)

Polymorphism - overloading

c)

Inheritance

d)

Polymorphism - overriding

e)

Composition

84.

A programming language using words and commands easy for humans to understand and organize, but which must be translated into a language easy for the computer to understand and execute.

a)

Compiled

b)

High Level

c)

Low Level

d)

Interpreted

85.

Which choice best describes the type of programming language directly understood and executed by a computer, consisting of pure 0s and 1s?

a)

Assembly Language

b)

Architecture

c)

Machine Language

d)

Pseudocode

86.

Choose the statement best classifying the following identifier example:

me_You

a)

Invalid - contains invalid symbols

b)

Invalid - does not start with a letter or underscore

c)

Valid

d)

Invalid identifier - Java reserved word

e)

Invalid identifier - contains spaces

87.

The fundamental type of data in a computer, the binary digit, or bit, is represented in different ways. Of the choices shown, check each one that is typically used to represent a bit.

a)

1, 0

b)

true, false

c)

on, off

d)

high voltage, low voltage

e)

warm, cold

88.

Choose the statement below that best classifies the following identifier example.

return

a)

Valid

b)

Invalid identifier - contains spaces

c)

Invalid - does not start with a letter or underscore

d)

Invalid identifier - Java reserved word

e)

Invalid - contains invalid symbols

89.

A customer from a startup company approaches a software development company with a software project to serve one of their company needs. A meeting is scheduled to begin the process of determining all aspects of the project during which representatives of the software company ask questions of the customer to ascertain the specific details of the requirements. Which choice represents this part of the software system life cycle?

a)

Implementation

b)

Design

c)

Maintenance

d)

Testing

e)

Analysis

90.

A "readme.txt" file is created to serve as instructions for a software project delivered to a customer. Which choice best describes this feature?

a)

Internal documentation

b)

Block comments

c)

Precondition

d)

Postcondition

e)

External documentation

91.

Which choice represents a program feature that activates a predefined block of code?

a)

Return method or function

b)

Method call

c)

Void method or procedure

d)

Procedure

92.

When a program executes just fine, but the outcome is incorrect, this is a classified as a ______________ error.

a)

Lexical

b)

Syntax

c)

Logic

d)

Runtime

93.

Which of the following are considered good program debugging strategies? Check all that apply.

a)

Look at the arrows in the compiler generated error messages to locate the error.

b)

Hide portions of the program that don't seem to work and "unhide" them one at a time until the offending line is discovered.

c)

Intentionally use bad data to see if your program can handle it.

d)

Read the error messages provided by the compiler.

94.

Which choice describes a programming block of code that produces a calculated value?

a)

Void method or procedure

b)

Return method or function

c)

Method call

d)

Procedure

95.

What output is produced by this block of code when 'b' is input?

a)

catpighorse

b)

catpighorsecow

c)

cat

d)

catpig

96.

In this pseudocode example, String name is an example of a(an) __________ parameter.

a)

Value

b)

Actual

c)

Formal

d)

Reference

97.

Not capitalizing a reserved word that should be capitalized in a programming statement is a ______________ error.

a)

Runtime

b)

Syntax

c)

Lexical

d)

Logic

98.

Which choices represent the possible operators correctly filling the blank resulting in an output value of 14? Check all that apply.

a)

b)

c)

>

d)

<

e)

99.

What is output by the pseudocode segment shown?

a)

25

b)

10

c)

15

d)

5

100.

Select all combinations that make this expression TRUE.

a)

boolean p ← false, boolean q ← false

b)

boolean p ← true, boolean q ← false

c)

boolean p ← false, boolean q ← true

d)

boolean p ← true, boolean q ← true

101.

Forgetting to end a string with a double quote symbol is a ______________ error.

a)

Logic

b)

Lexical

c)

Syntax

d)

Runtime

102.

The code segment below calculates a week's pay based on number of years experience. For 1 year of experience, the hourly wage is $7, for 2 years $8 an hour, 3 years $10, 4 years $12, and 5 years $15 per hour. The number of hours will vary between 1 and 40 hours. What input value for years will result in a totalWeekPay output value of $480?

(a)  

103.

Select the choice that represents the final value of z after the code segment is executed.

a)

True

b)

False

104.

What is output by the pseudocode segment shown?

a)

True

b)

False

105.

During the execution of a program, entering a String when an integer is expected is an example of a ______________ error.

a)

Syntax

b)

Logic

c)

Runtime

d)

Lexical

106.

What is output by the pseudocode segment shown?

a)

True

b)

False

107.

What is the complete output of this pseudocode segment? The answer contains exactly 8 single digits with no spaces between.

(a)  

108.

A switch statement is useful when your program logic contains a chain of ______.

a)

loops

b)

if else statements

c)

parameters

d)

method calls

e)

variable declarations

109.

The type of parameter where changes by the method DO affect the original data.

a)

Actual parameter

b)

Reference parameter

c)

Value parameter

d)

Formal parameter

110.

What is output by the pseudocode segment shown?

(a)  

111.

Select the choice representing the final value of this Boolean expression.

a)

True

b)

False

112.
Question Image

Match each line in the code segment below with the phrase that best describes the program statement on each line.

a)

Return Method Header

1.

Line 1

b)

Return Statement

2.

Line 2

c)

Assignment Statement

3.

Line 6

d)

Method Call

4.

Line 7

113.

What is output by this code segment?

(a)  

114.

Which choice shows the correct parameter signature for the doStuff method header based on the final output shown below?

a)

passed_by_reference int x, passed_by_reference y

b)

passed_by_value int x, passed_by_reference y

c)

passed_by_reference int x, passed_by_value y

d)

passed_by_value int x, passed_by_value y

115.
Question Image

Match each set of input values to the correct program result.

a)

line is ascending left to right

1.

1234

b)

line is descending left to right

2.

1432

c)

line is horizontal

3.

1232

d)

No output due to runtime error

4.

1213