Preparation Manual
Section 4: Sample Selected-Response Questions
TX PACT: Computer Science: Grades 8–12 (741)
Expand All Answers | Collapse All Answers
This section presents some sample exam questions for you to review as part of your preparation for the exam. To demonstrate how each competency may be assessed, sample questions are accompanied by the competency that they measure. While studying, you may wish to read the competency before and after you consider each sample question. Please note that the competency statements do not appear on the actual exam.
The correct answer is provided for each sample exam question. The sample questions are included to illustrate the formats and types of questions you will see on the exam; however, your performance on the sample questions should not be viewed as a predictor of your performance on the actual exam.
A Computer Science Style Conventions sheet is provided for your reference.
Domain I—Computational Thinking and Data Analysis
Competency 001—Understand problem solving and algorithm development.
1. 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.
- Enter to expand or collapse answer 1.Answer expanded
- Option D is correct. 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 002—Understand characteristics of algorithms.
2. 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
- Enter to expand or collapse answer.Answer expanded
- Option B is correct.
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
Competency 003—Understand data analysis, modeling, and simulation.
3. 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
- Enter to expand or collapse answer.Answer expanded
- Option C is correct. 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.
Domain II—Programming Concepts
Competency 004—Understand programming concepts and program design and development.
4. 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).
- Enter to expand or collapse answer.Answer expanded
- Option C is correct. 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 005—Understand characteristics and uses of data types.
5. 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"
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
- Enter to expand or collapse answer.Answer expanded
- Option C is correct. 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 006—Understand operators and control structures.
6. 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
- Enter to expand or collapse answer.Answer expanded
- Option A is correct. 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 007—Understand concepts of object-oriented design and programming.
7. 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
- Enter to expand or collapse answer.Answer expanded
- Option D is correct. 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.
Domain III—Computing Systems, Networks, and the Internet
Competency 008—Understand terminology and concepts related to computing systems.
8. The hexadecimal number 4F is equivalent to what decimal number?
- 19
- 79
- 154
- 415
- Enter to expand or collapse answer.Answer expanded
- Option B is correct. 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 009—Understand networks and the Internet.
9. 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
- Enter to expand or collapse answer.Answer expanded
- Option C is correct. 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.
Domain IV—Impacts of Computing
Competency 010—Understand social and global issues related to computer technology.
10. 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.
- Enter to expand or collapse answer.Answer expanded
- Option D is correct. 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.