3.1.1 Hacks

Question 1:

  • The answer is 1 because it is counting a number that is changing so it is integer.

Question 2:

  • The answer is 3 because it is a true or false question.

Question 3:

  • The answer is 1 because it is a number that is not changing.

Question 4:

  • The answer is 2 because it is too long.

Question 5:

  • The answer is 1 because it is true or false.

Question 6:

  • The answer is 4 because it is true statements.

Practice Questions I made:

  1. To check if the weather is good or not, what should it be? It is weatherGood and boolean
  2. To record the highest test score, what should it be? It is highTestScore and string
  3. To record the color of the phone, what should it be? It is phoneColor and string

3.1.2 Hacks

I got the last question wrong, and that's because I forgot which order it went and that it does not repeat at all. I now know that the correct answer is because the variables have values thanks to the previous five statements. In the sixth sentence, b is given the value of x + b, which is 40. The seventh sentence gives a the value of x + 1, or 21. The value of c + d / 2 is assigned to d in the ninth sentence. Division takes priority over addition in the order of operations. The number 50 is given to d since c is 30 and d / 2 is 20. The values of a, b, c, and d are shown in the final four assertions.

Practice Questions I made:

  • Question 1

num1 <- 8

num2 <- 3

num2 <- num1 + num2

DISPLAY(num2) = 11

  • Question 2

A <- 4

B <- 5

X <- A

DISPLAY(B) = 5

  • Question 3

Y <- 1

Z <- 2

W <- Y

DISPLAY(W) = 1

  • Question 4

T <- 45

D <- 12

X <- T + D

DISPLAY(X) = 57

  • Question 5

testA <- 40

testB <- 50

testC <- 60

testAll <- testA + testB + testC

DISPLAY(testAll) = 150

  • Question 6

labD <- 1

labE <- 2

labD <- labE

DISPLAY(B) = 1

3.2.2 Hacks

Question 1: 7

Question 2: 11

Question 3: 107

Question 4: 1100

Question 5: 101100

Question 6: 11111110

Question 7: 4

Question 8: 1

Question 9: 3

Question 10: 4

Question 11: 4

Question 12: 2

Question 13: 3

Question 14: 2

Question 15: 6