AP Computer Science A – Unit 1 Primitive Types Practice Test
AP Computer Science A – Unit 1 Primitive Types Practice Test
Quiz Summary
0 of 19 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 19 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- Answered
- Review
-
Question 1 of 19
1. Question
What data type would be best used to record the number of people at a party?
CorrectIncorrect -
Question 2 of 19
2. Question
What is the output for this statement?
System.out.print(“Good “);
System.out.print(“Morning!”);CorrectIncorrect -
Question 3 of 19
3. Question
What data type would be best used to record an email address?
CorrectIncorrect -
Question 4 of 19
4. Question
Consider the following code:
int a = 14;
int b = -15;
int c = 22;
int d = 11;
if(a > 12 && b < -14 && c < d) {
System.out.println(“YAY!!!!”);
} else if (d – 20 < b) {
System.out.println(“GO DO MORE PROGRAMMING!”);
} else if(a + 12 >= c) {
System.out.println(“This is vexing……”);
} else {
System.out.println(“This is very fun!”);
}}
What is the output for the code above?CorrectIncorrect -
Question 5 of 19
5. Question
What are the types of operators?
CorrectIncorrect -
Question 6 of 19
6. Question
What is the output for this statement?
System.out.println(“Good “);
System.out.println(“Morning!”)CorrectIncorrect -
Question 7 of 19
7. Question
Consider the code below:
int a = 24, b = 17, c = 5, d = 7;
b = b % d + a / b;
a %= b;
a -= 12;
What is the value of a at the end of the code above?CorrectIncorrect -
Question 8 of 19
8. Question
Which of the following is a valid variable declaration in Java?
CorrectIncorrect -
Question 9 of 19
9. Question
Which of the following declares a String array of size i? (Presume Java syntax.)
CorrectIncorrect -
Question 10 of 19
10. Question
What are the ways to create string objects in Java?
CorrectIncorrect -
Question 11 of 19
11. Question
What is the difference between double and int?
CorrectIncorrect -
Question 12 of 19
12. Question
What data type would be the answer to the expression x < 5?
CorrectIncorrect -
Question 13 of 19
13. Question
What is the difference between system.out.println() and system.out.print()?
CorrectIncorrect -
Question 14 of 19
14. Question
int x=2;
double y=2.1;
float z=3.0;
int c=(x*y) + z;
What is the value of cCorrectIncorrect -
Question 15 of 19
15. Question
Consider the following code:
int i = 55, j = 3;
System.out.println((i / j + 3) / 5);
What is the output for the code above?CorrectIncorrect -
Question 16 of 19
16. Question
int i = 100;
double d = 4.55, d2 = 3.75;int j = (int)(d * 100 + d2);
What is the value of j at the end of the code’s execution?CorrectIncorrect -
Question 17 of 19
17. Question
Consider the code below:
int[] vals = {841,-14,1,41,49,149,14,148,14};
boolean[] bools = new boolean[vals.length];
for(int i = 0; i < vals.length; i++) {
bools[i] = vals[i] > 20 && vals[i] % 2 == 0;
}
for(int i = 0; i < bools.length; i++) {
if(bools[i]) {
System.out.println(vals[i]);
}
}
What is the output of the code above?CorrectIncorrect -
Question 18 of 19
18. Question
Expressions cannot contain variables of different data types. True or false?
CorrectIncorrect -
Question 19 of 19
19. Question
string str = “Hello”
char newvar = str[4];
What is the value of newvar?CorrectIncorrect