Study Guide
Field 054: Computer Science
Sample Multiple-Choice Questions
Recommendation for individuals using a screenreader: please set your punctuation settings to "most."
Competency 0001
Understand problem solving and algorithm development.
The iterative design process would be most appropriately used in which of the following situations?
- large budget for project designers is available.
- A small project must be completed quickly by a single person.
- The project is well defined and has strict specifications.
- The major project requirements are known but details can evolve over time.
- Answer
-
Correct Response: D.
The iterative design process is a cyclic approach to designing, testing, analyzing, and refining a project. In each iteration, modifications can be made, incorporating details that change during the course of the project. Once the modifications are made, the project is again tested, analyzed, and refined.
Competency 0002
Understand characteristics of algorithms.
Use the pseudocode below to answer the question that follows.
function left parenthesis list right parenthesis slash slash index of a list starts at zero slash slash
len equals list.length left parenthesis right parenthesis slash slash finds the length of list slash slash
answer equals 0
for left parenthesis i equals 0, i is less than or equal to len minus 1, i equals i plus 1 right parenthesis
answer equals answer plus list left bracket i right bracket
answer eqals answer slash len
print left parenthesis answer right parenthesis
What will function left parenthesis left bracket 3, 4, 5 right bracket right parenthesis print?
- 3
- 4
- 5
- 6
- Answer
-
Correct Response: B.
There are 3 elements in the list, so len equals 3 and the for loop will iterate when i equals 0, 1, 2. At each iteration, the list element is added to the value of answer, which is initially assigned the value of 0. When the loop is complete, the quotient of answer and len is computed. The trace table for the loop is shown below.
i answer plus list left bracket i right bracket answer Initial 0 0 0 Loop 1 0 0 plus 3 3 Loop 2 1 3 plus 4 7 Loop 3 2 7 plus 5 12
When the loop terminates, answer equals 12 and len equals 3, therefore 12 slash 3 equals 4.
Competency 0003
Understand data analysis, modeling, and simulation.
Students have access to a data set that relates the air pressure as measured by a barometer to the amount of precipitation (rain) for the area in which they live. The students would like to create a computer program to analyze the data to determine whether knowing air pressure can help predict rain. Building this program requires application of which of the following mathematical concepts?
- quadratic functions
- complex numbers
- regression models
- Pythagorean triples
- Answer
-
Correct Response: C.
In statistics, regression models are used to analyze the relationship between a dependent variable and an independent variable. They are commonly used to make predictions by estimating the expected value of the dependent value, in this case the chance of rain, given the independent variable (air pressure). Linear regression models can produce the equation of the line that best fits the data, along with a measure of how well the two variables are correlated.
Competency 0004
Understand programming concepts and program design and development.
When a smartphone manufacturer releases a new feature, such as fingerprint scanning, the manufacturer needs to provide developers with the ability to incorporate this new feature into their software. This is typically accomplished through the use of:
- Open Systems Interconnection (OSI) model.
- graphical user interface (GUI).
- application programming interface (API).
- Cascading Style Sheets (CSS).
- Answer
-
Correct Response: C.
An API is a set of requirements that determine how one application (app) can talk to another. APIs allow developers limited access to a program's internal functions. In this case, a smartphone manufacturer would typically provide enough access for mobile device app developers to be able to integrate the fingerprint scanner into their apps without exposing all of the fingerprinting application code.
Competency 0005
Understand characteristics and uses of data types.
Use the information below to answer the question that follows.
// string.characterAt(i), returns the character at index i. //
// String index begins at zero. //
email = "last.first@school.edu"
slash slash string.characterAt left parenthesis i right parenthesis, returns the character at index i period slash slash
slash slash String index begins at zero period slash slash
email equals quote last period first at school period edu"
Which of the following methods will return @?
- email period characterAt left parenthesis 8 right parenthesis
- email period characterAt left parenthesis 9 right parenthesis
- email period characterAt left parenthesis 10 right parenthesis
- email period characterAt left parenthesis 11 right parenthesis
- Answer
-
Correct Response: C.
In the string last period first at school period edu, the at is the 11th character in the string. However, since the string index begins at 0, the index of the at is 10.
Competency 0006
Understand operators and control structures.
Use the information below to answer the question that follows.
The diagram is a 7 by 7 square grid. A dark line represents the path taken by a robot as seen from above. The line starts in the lower left corner, goes horizontally to the right one square, up one square, to the right one square, up one square, and continues in this pattern to the square in the fifth column over and fifth row to the right. The line ends at this point with an arrow pointing up.
The diagram above shows the path taken by a robot that starts facing in the positive y-direction at the point (0, 0) on a coordinate grid. It can move forward n units (Forward n), turn left 90 degrees (Turn Left), or turn right 90 degrees (Turn Right). Each grid line in the graphic represents 10 units.
Which of the following pseudocode segments will create the path shown in the diagram?
i equals 2
while left parenthesis i is less than 12 right parenthesis
if i is even
Turn Right
Forward 10
else
Turn Left
Forward 10
i equals i plus 1
i equals 2
while left parenthesis i is less than or equal to 12 right parenthesis
if i is even
Turn Right
Forward 10
else
Turn Right
Forward 10
i equals i plus 1
i equals 2
while left parenthesis i is less than 12 right parenthesis
if i is even
Forward 10
Turn Right
else
Forward 10
Turn Left
i equals i plus 1
i equals 2
while left parenthesis i is less than or equal to 12 right parenthesis
if i is even
Forward 10
Turn Right
else
Forward 10
Turn Left
i equals i plus 1
- Answer
-
Correct Response: A.
In this question, the robot begins at (0, 0), facing in the positive y-direction. To follow the path, the robot must first turn to the right and move 10 units in the positive x-direction, then turn left and move 10 units in the positive y-direction. This is accomplished by turning right when i is even and left when i is odd. Since i begins at 2, and the robot travels for 10 segments, the values for i will be 2 through 11; the loop will not execute once i equals 12.
Competency 0007
Understand concepts of object-oriented design and programming.
Use the pseudocode below to answer the question that follows.
CLASS Flower
private integer numOfPetals
private string color
private bloom left parenthesis right parenthesis
public grow left parenthesis right parenthesis
SUBCLASS Rose inherits from Flower
Rose left parenthesis numOfPetals, color right parenthesis
MAIN
Rose r1 equals Rose left parenthesis 5, left quote red right quote right parenthesis
Which of the following demonstrates how to access an element of the class Rose?
- r1 period numOfPetals
- r1 period color
- r1 period bloomleft parenthesis right parenthesis
- r1 period growleft parenthesis right parenthesis
- Answer
-
Correct Response: D.
In the program, r1 is an object, or instance of class Rose. Rose is a subclass of Flower, and inherits from it. Since Rose is a subclass, it can only access the public variables and methods, in this case the public method, grow left parenthesis right parenthesis. Therefore, r1 period grow left parenthesis right parenthesis is the only way to access an element of r1.
Competency 0008
Understand terminology and concepts related to computing systems.
The hexadecimal number 4F is equivalent to what decimal number?
- 19
- 79
- 154
- 415
- Answer
-
Correct Response: B.
In hexadecimal notation, the symbols 0 to 9 are used to represent the numbers 0 to 9 and the symbols A to F represent the numbers 10 to 15. Hexadecimal is a base-16 system. The hexadecimal number 4F can be converted to a decimal number as follows: 4 times 16 superscript 1 plus 15 times 16 superscript 0 equals 4 left parenthesis 16 right parenthesis plus 15 left parenthesis 1 right parenthesis equals 64 plus 15 equals 79.
Competency 0009
Understand networks and the Internet.
A client-side scripting language would most likely be used for which of the following tasks?
- rerouting messages
- storing information in a database
- adding interactivity to a web page
- executing code on a web server
- Answer
-
Correct Response: C.
In client-side scripting, source code is transferred from the web server to a user's computer over the Internet and run directly in the browser. Client-side scripting allows a web page to behave differently in response to mouse or keyboard actions. Rollover buttons, pop-up balloons, and filters for search criteria are all examples of interactive features that can be produced with client-side scripting.
Competency 0010
Understand social and global issues related to computer technology.
Which of the following statements best describes how Grace Hopper contributed to the field of computer science?
- She combined transistors, capacitators, and other components onto a single chip.
- She designed the logic gate architecture to perform various computational operations.
- She wrote the source code for the protocol used for early networks.
- She developed one of the first high-level programming languages.
- Answer
-
Correct Response: D.
Grace Hopper (1906 to 1992) was a rear admiral in the United States Navy and a computer scientist. She invented one of the first compiler-related tools and her work on machine-independent programming languages led to the development of COBOL.
Competency 0011
Understand effective learning environments.
A computer science curriculum that begins with a unit on problem solving instead of beginning with computer programming is likely to foster inclusive learning primarily because beginning with problem solving:
- provides students with opportunities to succeed regardless of their previous coding experience.
- teaches students the importance of working collaboratively in computer science.
- allows students without previous coding experience to take extra time to pre-learn code syntax.
- helps students of all backgrounds and abilities determine whether computer science is of personal interest.
- Answer
-
Correct Response: A.
Problem solving is a necessary skill in computer science and many other disciplines. When a unit begins with problem solving, students have the opportunity to engage with material that is concrete and relevant, and to use strategies with which they may already be familiar. This helps students build confidence in their ability to solve problems before moving on to coding computer projects.