
CSA Exam Review
Authored by enorberg@dupage88.net enorberg@dupage88.net
Computers
12th Grade
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
42 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code segment. int x = 20; int y = 10; int temp = x; x = y; y = temp * x; System.out.println(x + " " + y); What is printed as a result of executing this code segment?
10 100
10 200
20 100
20 200
2.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
In the following statement, j and k are properly declared and initialized int variables. boolean result = ((j > 0) && (k > 0)) || ((j < 0) && (k < 0)); Which of the following best describes the conditions in which result is assigned the value true?
When j and k are both equal to 0
When j and k are both positive or both negative
When j is greater than k
When j is positive and k is negative or when j is negative and k is positive
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following Painting class. public class Painting { private int year; private String artist; private String title; public Painting(int y, String a) { year = y; artist = a; title = "Untitled"; } // There are no other constructors. } Which of the following code segments, appearing in a class other than Painting, will correctly create an instance of a Painting object?
Painting p = new Painting("Frida Kahlo", "Self Portrait", 1939);
Painting p = new Painting(1939, "Frida Kahlo", "Self Portrait");
Painting p = new Painting("Frida Kahlo", 1939);
Painting p = new Painting(1939, "Frida Kahlo");
4.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code segment. int first = 5 + 10 * 2; int second = first + first % 2; What is the value of second after this code segment is executed?
37
30
26
0
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code segment. double cost = 25.0; double discount = 0.0; if (cost >= 100.0) { discount = 10.0; } else if (cost >= 50.0) { discount = 5.0; } else { discount = 2.0; } System.out.println(cost - discount); What is printed as a result of executing this code segment?
25.0
23.0
20.0
15.0
6.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code segment. for (int j = 10; j >= 0; j -= 2) // Line 1 { // Line 2 System.out.print(j - 1); // Line 3 } // Line 4 This code segment is intended to produce only the following output. It does not work as intended. 97531 Which of the following changes can be made so that this code segment works as intended?
In line 1, changing the condition j >= 0 to j > 0
In line 1, changing the condition j = 10 to j = 9
In line 3, changing the expression j - 1 to j + 1
In line 3, changing the expression j - 1 to j - 2
7.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code segment. String original = "DEFGHI"; String result = /* missing code */; System.out.println(result); Which of the following expressions can be used to replace /* missing code */ so that this code segment prints the string "HIDE"?
original.substring(4) + original.substring(0, 1)
original.substring(4) + original.substring(0, 2)
original.substring(5) + original.substring(1, 2)
original.substring(5) + original.substring(1, 3)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?