Study Guide

Field 181: Computer Science 
Sample Selected-Response Questions

Recommendation for individuals using a screenreader: please set your punctuation settings to "most."

Expand All | Collapse All

General Test Directions

This test consists of two sections: 1) a section with selected-response questions and 2) a constructed-response section.

Each question in the first section is a selected-response question with four answer choices. Read each question and answer choice carefully and choose the  start uppercase ONE end uppercase  best answer.

Try to answer all questions. Even if you are unsure of an answer, it is better to guess than not to answer a question at all. You will  start uppercase NOT end uppercase  be penalized for guessing.

The second section of this test consists of one constructed-response assignment. You will be asked to provide a written response to the assignment. Directions for completing your written response to the constructed-response assignment appear immediately before the assignment.

You may  start uppercase NOT end uppercase  use any type of calculator or reference materials during the test session.

Sample Selected-Response Questions

Competency 0001 
Apply concepts related to computer systems and computing devices.

1.  start bold Use the information below to answer the question that follows. end bold 

The following table gives the UTF8 code for several keyboard characters.

Character Code Table
Binary Octal Decimal Hexadecimal Symbol
0010 0000 040 32 20 (space)
0100 0001 101 65 41 A
0100 0010 102 66 42 B
0100 0011 103 67 43 C
0100 0100 104 68 44 D
0100 0101 105 69 45 E
0100 0110 106 70 46 F
0100 0111 107 71 47 G

According to the table, how much memory will be required to store the words "CAFE FEED" using the UTF8 code?

  1. 8 bits
  2. 8 bytes
  3. 9 bits
  4. 9 bytes

Correct Response: D. Computers store information using a binary system. A single bit can store either a 0 or a 1. A total of 8 bits is called a byte. The table shows a coding system in which characters are represented by 8 bits, or one byte. For example, a space between letters is represented by "0010 0000" and the letter "F" is denoted by "0100 0110". The string "C A F E F E E D" consists of a four-letter word, one space, and another four-letter word. Since each of these characters requires 1 byte, 9 bytes of memory will be required to store these words on a computer using the system shown in the table.


Competency 0002 
Apply knowledge of characteristics of computer networks and the Internet.

2. Which of the following best describes an important role of a client in a client-server network architecture?

  1. assigning addresses to network nodes
  2. sending requests to the server
  3. storing data in router look-up tables
  4. processing requests sent to the server

Correct Response: B. There are several different types of networks for connecting computers. Two of the most common examples are a client-server network and a peer-to-peer network. In a client-server network, one computer (the client) sends requests for information, such as a webpage or a particular file, to a second computer (the server). The server then processes the request and, if it makes sense, sends the requested information to the client. In the client-server network architecture, the server is usually a central computer that handles requests from multiple clients.


Competency 0003 
Apply knowledge of the problem-solving process and algorithm design.

3. Which of the following actions best illustrates the principle of abstraction in object-oriented programming?

  1. assigning a value to a newly created object
  2. identifying the reusable entities in a program design
  3. identifying the flow of control in a real-world system
  4. passing a return value from a method to the caller

Correct Response: B. In computer science, one aspect of abstraction is associated with taking a problem and breaking it down to its most essential features. This involves viewing the problem as a series of modules or subroutines. An advantage of this approach is that the modules or subroutines can often be reused, since many tasks in computing are similar. A programmer may write modules that can be used multiple times in a variety of programs, or access libraries of existing modules. This allows problems to be solved without the programmer having to rewrite all of the code or understand all of the details of how the modules are implemented.


Competency 0004 
Analyze types and characteristics of algorithms.

4.  start bold Use the diagram below to answer the question that follows. end bold 

diagram of a flowchart for a program that calculates the factorial of a number input by the user

The diagram is a vertical flowchart. At the top is an oval that says Begin. It leads to a parallelogram that says Get n from user. This leads to a rectangle that says Set factorial = 1. This leads to a diamond that says Is n greater than 1? If No, this leads to a parallelogram that says Output factorial and then to an oval that says End. If Yes, the diamond leads to a rectangle that says Multiply factorial by n. This leads to a rectangle that says Subtract one from n. This leads back to the diamond that says Is n greater than 1?

The diagram shows a flowchart for a program that calculates the factorial of a number input by the user. If the user inputs the number 50, how often will the decision block labeled "Is n greater than 1?" be performed?

  1. 48
  2. 49
  3. 50
  4. 51

Correct Response: C. Flowcharts are a method of representing the logic of an algorithm. In the flowchart shown, the initial value is n equals 50. On the first evaluation, the code checks if 50 is greater than 1 which is yes, so the computer finds the product of 1 and 50, or 1 times 50 and subtracts 1 from n equals 50 to get n equals 49, On the second evaluation, the code checks if 49 is greater than 1 which is yes, multiplies start italics factorial end italics (which is 1 times 50) by 49 to get 1 times 50 times 49 and subtracts 1 from n equals 49 to get n equals 48. On the third evaluation it checks if n is greater than 48 which is yes, reassign start italics factorial end italics equals 1 times 50 times 49 times 48 and subtracts 1 from n equals 48 to get n equals 47. Continuing this pattern shows that the program checks if n is greater than 1 when n equals 50, 49, 48 elipses 4, 3, 2, 1. The 50th time it checks if 1 is greather than 1 the result is start italics no end italics and the program prints start italics factorial end italics equals 1 times 50 times 49 times 48 ellipses times 4 times 3 times 2.


Competency 0005 
Apply knowledge of principles and procedures for program development.

5. A student creates the algorithm below to find the sum of five numbers input by a user. The algorithm contains an error.

integer sum  equals  0

for (i  equals  0; i  less than  5 ; i  equals  i  plus  1)

{

print("Enter an integer: ")

integer data  equals  getUserInput()

integer num  equals  convertToInt(data)

sum  equals  sum  plus  i

}

print(sum)

Which of the following changes should be made to the algorithm to correct the error?

  1. change "i  equals  0" to "i  equals  1"
  2. change "i  less than  5" to "i  less than or equal  5"
  3. change "sum  equals  sum  plus  i" to "sum  equals  sum  plus  num"
  4. change "num  equals  convertToInt(data)" to "convertToInt("data")"

Correct Response: C. The goal of the program is to print the sum of five numbers input by the user. When first run, i equals 0. Suppose the user inputs 10. The program will convert the input into an integer and then find sum equals sum plus i, which will result in sum equals 0 plus 0, not sum equals 0 plus 10. This is an error, because as written the program sums the loop values left paren i right paren instead of the values of the numbers input left paren num right paren. To correct this error, the program needs to find the sum of the numbers input left paren num right paren by the user, which can be done by changing sum equals sum plus i to sum equals sum plus num.


Competency 0006 
Apply knowledge of characteristics and applications of data types.

6. Use the pseudocode below to answer the question that follows.

list1  equals  [5, 4, 3, 2, 1]  //first element in list has index  equals  0//

integer n  equals  length of list1

integer i  equals  1

while (i  less than  n)

{

print(list1[i]  plus  list1[i - 1])

i  equals  i  plus  1

}

Which of the following numbers will the code print?

  1. 8 5 3
  2. 8 6 4
  3. 9 7 5 3
  4. 9 7 5 4

Correct Response: C. The length of the list is the number of elements in the list, so n equals 5. When i equals 1, the list will print list1 left bracket 1 right bracket plus list1 left bracket 0 right bracket equals 4 plus 5 equals 9, since the first element in the list (the integer 5) has index equals 0. When i equals 2 it will print list1 left bracket 2 right bracket plus list1 left bracket 1 right bracket equals 3 plus 4 equals 7, when i equals 3 it will print list1 left bracket 3 right bracket plus list1 left bracket 2 right bracket equals 2 plus 3 equals 5, and when i equals 4 it will print list1 left bracket 4 right bracket plus list1 left bracket 3 right bracket equals 1 plus 2 equals 3.


Competency 0007 
Apply knowledge of types and characteristics of statements, operators, and control structures.

7. Given the statement (A OR B) AND (C AND D), which of the following is True?

  1. A  equals  True, B  equals  True, C  equals  True, D  equals  False
  2. A  equals  True, B  equals  True, C  equals  False, D  equals  True
  3. A  equals  False, B  equals  True, C  equals  False, D  equals  True
  4. A  equals  False, B  equals  True, C  equals  True, D  equals  True

Correct Response: D. The AND statement left paren C AND D right paren will evaluate as True if, and only if, both C equals True and D equals True. Hence, C and D must both be True. The OR statement left paren A OR B right paren will evaluate as True if A equals False and B equals True or if A equals True and B equals False, or if A equals True and B equals True. Therefore, left paren False OR True right paren AND left paren True AND True right paren equals left paren True AND True right paren equals True.


Competency 0008 
Apply knowledge of object-oriented programming.

8. Use the information below to answer the question that follows.

class Bike

{

private integer speed

public String color

private stop()

public ride()

}

class RoadBike inherits from Bike

Which of the following is a method that can be accessed by RoadBike?

  1. speed
  2. color
  3. stop()
  4. ride()

Correct Response: D. The class Bike has two class variables and two methods. The class variables are private integer speed and public String color. These are variables since they are declared as integer and String datatypes. The two methods (sometimes called functions) are stop() and ride(). The open and closed parentheses indicate that these are methods, in this case, methods that do not take parameters. The words public and private are access specifiers that determine whether a given variable or method can be accessed outside of class Bike. Entities that use the public access specifier can be accessed outside of the class, whereas entities that use the private access specifier can only be accessed within the class. The class RoadBike is outside of class Bike, so ride() is the only method that can be accessed by RoadBike, since it has a public access specifier.


Competency 0009 
Apply knowledge of effective teaching strategies and learning environments.

9. Which of the following is the best example of how unified modeling language (UML) is commonly used in computer programming?

  1. visualizing the components of an object-oriented software system
  2. creating a template for a graphical user interface
  3. checking for invalid input during program execution
  4. writing pseudocode specific to procedural languages

Correct Response: A. U M L is a visual language that includes a set of graphical notation techniques to create visual abstract models of object-oriented software systems.


Competency 0010 
Apply knowledge of the social aspects of computing and the role computer science plays in society on a local, national, and global level.

10. A high school computer science teacher has a class of students from diverse backgrounds. The teacher strives to find scenarios, projects, and applications of programming concepts that can be applied to a variety of situations with which the students are likely to be familiar. The teacher stresses how technology can be used to solve problems and improve people's lives. This approach to teaching computer science best demonstrates which of the following ideas related to creating a more inclusive computer science program?

  1. the use of culturally appropriate content to boost interest and motivation to learn
  2. the importance of being aware of one's own biases and how they can affect teaching
  3. the importance of actively recruiting underrepresented students into computer science
  4. the use of hands-on learning to keep students actively engaged in the learning process

Correct Response: A. Computer science is a field in which students have the opportunity to be creative and to solve important problems. Providing a group of diverse students with scenarios and projects that involve situations in which the students are familiar is an approach that can help boost interest and motivation to learn computer concepts.