Download - Objective Type Quiz 1
![Page 1: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/1.jpg)
Objective Type Quiz 1
4.10 – 4.10.5
![Page 2: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/2.jpg)
1-4. What are four types of operators used in Java?
![Page 3: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/3.jpg)
5. What is the output of the following codes:
int num = 56 % 9;System.out.print(num);
a. 2b. 4c. 6d. 6.22
![Page 4: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/4.jpg)
6. Fill in the blanks
int buda = 4;int pest = 15;Int budapest = pest___buda;System.out.println(budapest);//The output must be 3.
![Page 5: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/5.jpg)
7-8. What is the output of the following codes:
int val = 3;int you = val;val = 4;int tube = ++val;val = you + tube;System.out.print(val);
![Page 6: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/6.jpg)
9. What is the output of the following codes:
int ice = 11;int buko = 15;int refreshment = ice / buko;System.out.println(refreshment);
![Page 7: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/7.jpg)
10. When an integer and a float are used as operands to a single
arithmetic operation, the result is a _______.
a. Integerb. Floatc. Doubled. Char
![Page 8: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/8.jpg)
11. True or False. The increment and decrement operators can only be
placed after an operand.
![Page 9: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/9.jpg)
12-13. Write the prefix form and the postfix form of writing the decrement
of an operand called “num”.
![Page 10: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/10.jpg)
14-16. What is the output of the following code:
int a = 1;int b = 1;int c;c= ++b;a++;System.out.println(“a = “+a); // #14System.out.println(“b = “+b); // #15 System.out.println(“c = “+c); // #16
![Page 11: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/11.jpg)
17. _____ operators compare two values and determine the relationship
beween those values.
![Page 12: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/12.jpg)
18. What is the output of the following codes.
public class Relations{
public static void main(String[] args) {
double val1 = 2.601;double val2 = 2.60;
Boolean test = false;test = (val1 <= val2);
System.out.print(test);
}}
![Page 13: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/13.jpg)
19. Yes or No.
Is (val1 > = val2) an error?i.e. there is a space between > and =
![Page 14: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/14.jpg)
20. Fill in the blanks
float horse = 2.0f;float chicken = 2.00f;Boolean compare = ________;//chicken is equal to horse.
![Page 15: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/15.jpg)
21. Logical operators have one or two _______ operands that yield a
_______ result.
![Page 16: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/16.jpg)
22. What is this symbol: &&?
a. Boolean logical andb. Logical andc. Logical ord. Boolean logical exclusive and
![Page 17: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/17.jpg)
23. What is this symbol: ^?
a. Logical orb. Boolean logical exclusive orc. Boolean logical inclusive ord. Logical not
![Page 18: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/18.jpg)
24. The basic difference between && and & operators is that && supports
___________ evaluations.
![Page 19: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/19.jpg)
25. What is the output of the following codes:
int cost = 23;int price = 13;boolean econ = false;
econ = (cost < 20) || (price > 10);System.out.print(econ);
![Page 20: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/20.jpg)
26. What is the output of the following codes:
int nature = 10;int spring = 11;boolean water = false;
water = (nature > 20%7) || (spring > nature);System.out.print(water);
![Page 21: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/21.jpg)
27. ____ operator is an operator that takes in three arguments to form a
conditional expression.
![Page 22: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/22.jpg)
28. Which of the following is the structure of an expression using a
conditional operator?a. exp1:exp2:exp3b. exp1:exp2?exp3c. exp1?exp2;exp3d. exp1?exp2:exp3e. exp1;exp2?exp3
![Page 23: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/23.jpg)
29. Fill in the blanksint driverSpeed = 80;String violation = “”;//If speed is greater than 80, driver gets ticket.violation = (________)?”You don’t get ticket”:”You get ticket”;
System.out.println(violation)
//OUTPUT: You get ticket
![Page 24: Objective Type Quiz 1](https://reader036.vdocuments.us/reader036/viewer/2022062409/5681515a550346895dbf7d36/html5/thumbnails/24.jpg)
30-32. Was the test too hard? Here’s a three point bonus:
EradngElvteaeGltesurgLecndasEdteiavRapyhetRanietreughn