Professional Documents
Culture Documents
Code Plus
Code Plus
1. What will be the value of x after the following section of code executes
int x = 5;
if (x > 3){
x = x – 2;
else
x = x + 2;
A. x = 3
B. x = 4
C. x = 6
D. x = 8
2. What will be the value of y after the following section of code executes
int y = 4, z = 3;
if (y > 4)
z = 2;
y = y – 1;
else{
z = 1;
y = z;
A. y = 4
B. y = 5
C. y = 1
D. y = 3
3. What will be the value of w after the following section of code executes
int w = 4, q = 3;
if (q > 5){
if (w == 7)
w = 3;
else
w = 2;
else{
if (w > 3)
w = 1;
else
w =0;
A. w=3
B. w=2
C. w=1
D. w=4
4. What will be the value of b after the following section of code executes
int a = 4, b = 0;
if (a < 5){
b = 4;
b = 3;
}
b = 2;
else{
b = 1;
A. b=2
B. b=3
C. b=4
D. b=5
int color = 3;
switch (color)
case 1:System.out.print("green");break;
case 2:System.out.print("red");break;
case 3:System.out.print("blue");break;
case 4:System.out.print("purple");break;
default:System.out.print("gray");break;
A. green
B. red
C. purple
D. blue
E. gray
A. 1 2 3
B. 3 2 1
C. 3 1 2
D. 2 1 3
int count;
A. 4 3 2
B. 3 4 2
C. 2 4 3
D. 2 3 4
8. What will be the value of total after the following section of code executes
A. total=20
B. total=30
C. total=35
D. total=40
9. What will be the value of w after the following section of code executes
int x = 2;
var data = [
];
10. What will be the value of x and y after the following section of code executes
y = x == 20 ? (y-x)+5 : y == 30 ? (x+y)+5 : 0;
A. x=70, y=15
B. x=50, y=25
C. x=30, y=115
D. x=50, y= -15
11. What will be the value of z after the following section of code executes
int z = 100;
array.forEach(data => {
});
A. z=97
B. z=106
C. z=94
D. z=103
12. What will be the value of q after the following section of code executes
int q = 0 , x = 5;
while(x <=20)
q + 3;
x +5;
A. q=9
B. q=8
C. q=7
D. q=6
13. What will be the value of color after the following section of code executes
int i = 1;
while (colors[i]) {
i++;
A. color=Red, Green
B. color=Blue, Red
C. color=Red, Blue
D. color=Blue, Green
14. What will be the value of day after the following section of code executes
var day;
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
A. day = Sunday
B. day = Monday
C. day = Tuesday
D. day = Wednesday
E. day = Thursday
F. day = Friday
G. day = Saturday
15. What will be the value of xyz after the following section of code executes
A. xyz = 3
B. xyz = 4
C. xyz = 5
D. xyz = 8
16. Create Students table where we can set the students details and Primary key as
StudentId .(StudentId,LastName,FirstName,YearLevel)
17. Create Subjects table where we can set Subject details and Primary key as SubjectId
and all columns are not nullable.(SubjectId,YearLevel,Name,FieldId)
18. Create Grades table where we can set the grades details and Primary key as FieldId and
all columns are not nullable..(FieldId,SubjectId,PassFail)
19. show result of each student's grades in subject and whether they pass/fail.
20. show result for getting the passing rates of each subject.
21-22. Add "Tuazon, Bonn","Escudero, Markelon" where year level is 1 on Students Table