CSP
CSA
Base Conversions
Error Detection
Miscellaneous
100

In 2013, hackers tricked a third-party vendor into clicking a malicious link that installed software that compromised the credit card numbers and other personal information for millions of Target customers. (Target is a large retail chain.) What category of cyber attack does the Target hack fit into? 

Phishing attack

100

Evaluate the following: Math.sqrt(4) / Math.sqrt(100)

0.2

100

What does "bit" stand for?

A binary unit

100

Identify possible errors that could occur in this code

String first = "mr";

String second = "duff";


result = first + second; 

System.out.println(result);

Variable "result" not declared

100

A train takes 5 seconds to pass through an 85 meter tunnel and 8 seconds to pass through a 160 meter tunnel. Assuming constant speed, how fast is the train?

25 m/second

200

Sami is creating a game. The game will allow the player to move a small alien through a maze to return it safely to its spaceship.

Sami has started to tackle the problem by hiding unnecessary details; what computational thinking principle has Sami applied?

  • Algorithmic thinking

  • Decomposition

  • Abstraction

  • Pattern recognition

Abstraction

200

This one-dimensional array stores different weather conditions:

Sunny |Windy | Cloudy | Raining | Snowy

Assuming the array is indexed from 0, what weather condition is in index position 2?

Cloudy

200

In an 8-bit environment, what is the result of 1111 1111 + 0000 0001?

Overflow, 0000 0000

200

Identify possible errors that could occur in this code

String first = "mr";

String second = "dduff";


String result = first.substring(0, 2) + second.substring(1,5);

System.out.println(result)

';' expected

200

Ben is 5 years older than Carla. Carla is 3 years younger than Ali. All three ages add up to 44. How old is Ben?

Ben is 17 years old.

300

What are 2 examples of escape sequences? Double points if you can name 4.

Acceptable answers: \n, \t, \\, \", \'\r, \b, \f, \uXXXX

300

What does the following boolean expression evaluate to? (a && !b) || (a && b)

Always true

300

Each student that enrolls at a school is assigned a unique ID number, which is stored as a binary number. The ID numbers increase sequentially by 1 with each newly enrolled student. If the ID number assigned to the last student who enrolled was the binary number 1001 0011, what binary number will be assigned to the next student who enrolls?

1001 0100

300

Identify possible errors that could occur in this code

String first = "mr";

String second = "duff";


String final = first + second;

System.out.println(final);

Final keyword cannot be used in variable name

300

Lucius is counting backward by 7s. His first three numbers are 100, 93, and 86. What is his 10th number?

37

400

Using a binary search, how many iterations would it take to find the letter w? str ← [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]

3

400

What is the maximum number of comparisons that a binary search will apply for an array of length 30?

5 comparisons

400
Convert 67 (Base 41) to Base 10
253
400


What input-based errors could occur with this code at runtime?

public static int calculate(int a, int b, String op) {

     if (op.equals("+")) {

          return a + b;

     }

     else if (op.equals("-")) {

          return a - b;

     } 

     else if (op.equals("*")) {

          return a * b;

     } 

     else if (op.equals("/")) {

            return a / b;  

     }

}

ArithmeticException error divide by 0


Also acceptable: no output from a garbage operator input

400

A fair coin is tossed three times. Work out the probability of getting two heads and one tail.

3/8

500

Amaia coaches a school basketball team. She keeps the scores that the team got in the latest tournament in a list that can be seen below:

basketball_finals

120 | 250 | 101 | 150 | 80 | 95 | 147 | 165

Amaia is using the linear search algorithm to find out if the team scored 200 points in any of the games. How many comparisons will the linear search algorithm perform before it finishes?

8

500

int sum = 0;

for (int i = 1; i<2; i++)

   for (int j = 1; j <=3; j++)

      for (int k =1; k<4; k++)

         sum+=(i * j * k);

System.out.println(sum);

18

500

What is the product of 1101 * 1011? (Answer may be given in decimal or binary)

143 or 1000 1111

500

Identify possible errors that could occur in this code

String first = "mr";

String second = "duff";


String final = first + second;

System.out.println(final);

Final keyword cannot be used in variable name

500

What comes next in this sequence of letters? O, T, T, F, F, S, S, __

E for Eight (the sequence is one, two, three, ...)