Skip to main content

Computer Science K to 12

Test Format and Sample Questions

The Computer Science K to 12 subject area test consists of approximately 80 multiple-choice questions. You will have two and one-half hours to complete the test.

Each question will contain four response options, and you will indicate your answer by selecting A, B, C, or D.

The table below presents types of questions on the exam and directs you to examples of these formats among the sample items that follow.

Table of Question Formats

Type of Question Sample Question
Sentence Completion
Select the response option that best completes the sentence.
Question 1
Scenario
Examine a situation, problem, or case study. Then answer a question, make a diagnosis, or recommend a course of action by selecting the best response option.
Question 2
Command
Select the best response option.
Question 4
Direct Question
Choose the response option that best answers the question.
Question 6

Sample Questions

The following questions represent both the form and content of questions on the examination. These questions will acquaint you with the general format of the examination; however, these sample questions do not cover all of the competencies and skills that are tested and will only approximate the degree of examination difficulty.


Question 1

Competency 1—Knowledge of computational thinking and problem solving

DIRECTIONS: Read the question and select the best response.

Using string methods would be an appropriate part of a solution strategy for

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 2

Competency 1—Knowledge of computational thinking and problem solving

DIRECTIONS: Read the question and select the best response.

A programmer would like to determine the most efficient algorithm for ordering a large, finite list of integers from largest to smallest. The programmer has the following information on several sorting algorithms.

Algorithm Average complexity
selection sort n2
merge sort n log n
bogosort n n !
shell sort n (log n)2

Which algorithm is likely to be most appropriate for this task?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 3

Competency 1—Knowledge of computational thinking and problem solving

DIRECTIONS: Read the question and select the best response.

The pseudocode below prompts the user to enter data from the keyboard one number at a time. Given the keyboard inputs 2, 5, 4, 5, and 4 in that order, what is the correct output of the following algorithm?

    sum = 0
    i = 0
    while (i < 5) do {
        print "Input a number, n"
        input n
        if (n mod 2 is equal to 0) then sum = sum + n
        i = i + 1
    } endwhile
    avg_total = sum / i
    output avg_total
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 4

Competency 1—Knowledge of computational thinking and problem solving

DIRECTIONS: Read the question and select the best response.

Given the following program segment, select the minimum set of data required to test all cases.

    print "What was your score on the test?" 
    input score
    if (score ≥ 90)
        then print "Excellent!"
    else if (score ≥ 75)
        then print "Not too bad."
    else
        print "Study harder next time!"
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 5

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

Which variable in the following pseudocode program segment would be considered global?

    function1(int w) {
        int x = 12
        /* some code */
    }
    int y = 5
    mainProgram( ) {
        int z = 7
        function1(z)
        /* some more code */
    }
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 6

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

A variable of type Boolean would be most appropriate to store the result of which of the following types of tasks?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: D.

Question 7

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

Which of the following base ten numbers is equal to the hexadecimal number 3A9C?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 8

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

Which of the following data structures would be most appropriate for a computer program to keep track of and choose from a list of applicants for available season football tickets?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 9

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

According to the pseudocode below, which line of the code constructs an instance of a class?

    1)      import from library Rectangle;

    2)      class TestRectangle{
    3)              mainProgram() {
    4)              int xcorner, ycorner, width, height
    5)              xcorner = 50
    6)              ycorner = 30
    7)              width = 5
    8)              height = 10

    9)              Rectangle rect = new Rectangle(
                            xcorner, ycorner, width, height)
    10)             print ("The x-coordinate of the rectangle is " 
                            + rect.getX())
    11)             }
    12)     }
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 10

Competency 2—Knowledge of data types and structures

DIRECTIONS: Read the question and select the best response.

According to the code segment below, which method can only be accessed from within the class Rectangle?

    public class Rectangle {
        private int mywidth
        private int myheight
        private int myarea
        private int myperim

        /* some code */

        private findArea( ) {
            myarea = mywidth* myheight
        }

        public findPerimeter( ) {
            myperim = mywidth + myheight
        }

        public setHeight(int height) {
            myheight = height
        }

        public setWidth(int width) {
            mywidth = width
        }

    }
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 11

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

The pseudocode below, used to determine if the user input is in the requested range, contains an error.

    print "Type a number from 1 to 100, inclusive"
    input number
    if (number > 1) or (number < 100)
        then print "The number is in the correct range"

Which code segment corrects the error?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 12

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

Which of the following best describes the primary reason for producing internal program documentation?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 13

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

In an object-oriented programming language, encapsulation is most likely to be implemented through the use of

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 14

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

When n = 5, which of the following loops will generate the output values 1, 2, 3, 4, 5, and 6?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: D.

Question 15

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

A student has a horizontal list of numbered cards and sorts them manually by moving the cards in the sequence below.

  1. Find the smallest card in the list and exchange it with the first card in the list.
  2. Find the next smallest card in the list and exchange it with the second card in the list.
  3. Repeat these instructions until the original list is sorted.

Which of the following algorithms is described above?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 16

Competency 3—Knowledge of programming logic

DIRECTIONS: Read the question and select the best response.

The following pseudocode is used to determine admission prices.

    if ((not age > 55) and (not age < 22) and (haveCoupon = False)) {
        admission = 15.00
    }
    else {
        admission = 10.00
    }

Which of the following segments of pseudocode is equivalent?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.

Question 17

Competency 4—Knowledge of programming languages

DIRECTIONS: Read the question and select the best response.

A student creating a program using the Scratch™ programming environment from the MIT Media Library would most likely be engaged in which of the following activities?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 18

Competency 4—Knowledge of programming languages

DIRECTIONS: Read the question and select the best response.

What will be the output when the following section of Java registered trademark symbol  code runs?

    int x = 5;
    int y = 10;
    int z;
    z = x;
    x = y;
    y = z;
    System.out.println(x + " " + y);
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 19

Competency 4—Knowledge of programming languages

DIRECTIONS: Read the question and select the best response.

A Java registered trademark symbol  class is defined as follows.

    public class TestingFunctions
    {
        public void fun1(int a)
        {
                a++;
                System.out.println(a);
        }
        public void fun2(int b)
        {
                b--;
                this.fun1(b);
        }
    }

In addition, the following lines of code are executed from the instance of another class that has access to the TestingFunctions class through an import statement.

    int x = 5;
    TestingFunctions test = new TestingFunctions( );
    test.fun2(x);

What will be the output from these three lines of code?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 20

Competency 4—Knowledge of programming languages

DIRECTIONS: Read the question and select the best response.

According to the following segment of Java registered trademark symbol  code, which Java registered trademark symbol  string method should be used to print "Extra" to the screen?

    String text = "Extra Special!";
    String part = /* string method */
    System.out.println(part)
Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 21

Competency 4—Knowledge of programming languages

DIRECTIONS: Read the question and select the best response.

Two Java registered trademark symbol  classes are defined as follows.

    public class Class1 {
        public void m1( ) {
            System.out.print("one");
        }
        public void m2( ) {
            System.out.print("two");
            this.m1( );
        }
    }
    public class Class2 extends Class1 {
        public void m1( ) {
            System.out.print("three");
            super.m2( );
        }
        public void m2( ) {
            System.out.print("four");
        }
    }

In addition, the following code appears in the instance of another class that has access to these two Java registered trademark symbol  classes by import statements.

    Class2 number = new Class2 ( );
    number.m1( );

What will be printed by these two lines of code?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 22

Competency 5—Knowledge of computer hardware, software, and networking

DIRECTIONS: Read the question and select the best response.

A teacher has created the spreadsheet below to calculate average quiz grades for several students.

spreadsheet sample
  A B C D E F
1 Student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Average
2 this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank.
3 Student 1 64 72 84 90 77.5
4 Student 2 84 87 90 81 85.5
5 Student 3 89 90 94 92 91.25
6 Student 4 90 88 93 88 89.75
7 this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank. this cell intentionally left blank.
8 Average 81.75 84.25 90.25 87.75 86

Which of the following formulas could be used to calculate the average quiz grade for Student 3?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 23

Competency 5—Knowledge of computer hardware, software, and networking

DIRECTIONS: Read the question and select the best response.

At which of the following layers of the Open Systems Interconnection model is wireless network technology implemented?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: D.

Question 24

Competency 5—Knowledge of computer hardware, software, and networking

DIRECTIONS: Read the question and select the best response.

Which of the following devices would be most appropriate for connecting a local area network using one protocol with a wide area network using a different protocol?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 25

Competency 6—Knowledge of the historical aspects and social issues related to computer technologies

DIRECTIONS: Read the question and select the best response.

Which of the following best describes the malicious nature of worm software?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 26

Competency 6—Knowledge of the historical aspects and social issues related to computer technologies

DIRECTIONS: Read the question and select the best response.

The most significant drawback associated with software that uses signature-based detection methods for identifying computer malware is that the software will

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: B.

Question 27

Competency 6—Knowledge of the historical aspects and social issues related to computer technologies

DIRECTIONS: Read the question and select the best response.

A plan for ensuring the fault tolerance of a computer network would most likely contain a strategy for

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 28

Competency 7—Knowledge of computer science pedagogy

DIRECTIONS: Read the question and select the best response.

A teacher is developing a rubric for assessing students' computer programs. One of the teacher's goals is that students will be able to explain how their programs work. Which of the following rubric components is most closely aligned with this goal?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: D.

Question 29

Competency 7—Knowledge of computer science pedagogy

DIRECTIONS: Read the question and select the best response.

Which of the following types of computer software would be most effective in helping an English language learner make connections between written and spoken English?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: C.

Question 30

Competency 7—Knowledge of computer science pedagogy

DIRECTIONS: Read the question and select the best response.

An elementary school teacher would like to pursue professional development opportunities for integrating computational thinking and programming concepts into the classroom. Which of the following organizations could provide the teacher with the most relevant resources to achieve this goal?

Choose an answer
Enter to expand or collapse answer.Answer expanded
Correct Response: A.