0%
0 votes, 0 avg
28

This quiz randomly generates 20 questions as asked in AP Computer Science A (AP CSA) - Programming in Java.

Congratulations!

(AP CSA) - Programming in Java

AP Computer Science A (AP CSA) - Programming in Java

This quiz randomly generates 20 questions (in 30 mins) as asked in AP Computer Science A (AP CSA) - Programming in Java.

1 / 20

What is the output?

2 / 20

Assume Dog is a subclass of Animal. Both classes have a method makeSound(). If the following code is executed, which method is called?

Animal myPet = new Dog();
myPet.makeSound();

3 / 20

What is the minimum number of bits you would need to encode the 26 letters of the alphabet plus a space - a total of 27 characters?

4 / 20

In Java an attempt to divide an integer by 0 will result in which of the following exceptions?

5 / 20

What value is assigned to the variable “z” in the code below?
int x = 4;
int y = 1 + x / 2;
int z = 0;
z += (y*4);

6 / 20

Which two modifications, when made independently, enable the code to print joe:true:100.0 ? ( Choose Two)

7 / 20

What is the output ?

8 / 20

If Square is a subclass of Rectangle, and Rectangle is a subclass of Shape, which of the following declarations will cause a compile-time error?

9 / 20

Which code fragment, when inserted at line 6, enables the code to print true?

10 / 20

Question

11 / 20

Given the classes below, which of the following is the correct way to write the Car constructor to initialize both make and model?

12 / 20

Which of the following is a valid way to use an enhanced for-loop to print every element in int[][] arr?

13 / 20

ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter "G" is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table below.
A-65
B-66
C-67
D-68
ASCII characters can also be represented by binary numbers. According to ASCII character encoding, which of the following letters is represented by the 8-bit binary value: 0100 0010

14 / 20

Question

15 / 20

Which of the following print out the last element of the integer array?
int[] array = {1, 2, 3, 4};
I)
int last = array[array.length];
System.out.println(last);
II)
int last = array[array.length-1];
System.out.println(last);
III)
int last = array[-1];
System.out.println(last);

16 / 20

Refer to the code:

Consider the implementation of a writeDeck method that is added to the Deck class.

17 / 20

Which of the following is true about arithmetic operations?
I. An arithmetic operation that uses two integer values will evaluate to an integer value.
II. It is impossible to add 1 to a variable without ever using the number 1 in a statement.
III. An arithmetic operation that uses a double value will evaluate to a double value.

18 / 20

What is the output?

19 / 20

Consider the following code segment. What will the nums list contain after execution?

20 / 20

What is the output?

Your score is

0%

Scroll to Top