0% found this document useful (0 votes)
17 views6 pages

Holmes 3rd Trimester Final

Uploaded by

Annjelyn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Holmes 3rd Trimester Final

Uploaded by

Annjelyn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Holmes 3rd Trimester Final

1. The rules of a programming language constitute its ____.


a. objects
b. logic
c. format
d. syntax
2. The individual operations used in a computer program are often grouped into
logical units called .
a. procedures
b. variables
c. constants
d. logistics
3. Envisioning program components as objects that are similar to concrete
objects in the real world is the hallmark of .
a. command-line operating systems
b. procedural programming
c. object-oriented programming
d. machine languages
4. An instance of a class is a(n) .
a. object
b. procedure
c. method
d. class
5. All Java programming statements must end with a .
a. period
b. comma
c. semicolon
d. closing parenthesis
6. In a Java program, you must use to separate classes, objects, and
methods.
a. commas
b. semicolons
c. dots
d. forward slashes
7. All Java applications must have a method named .
a. method()
b. main()
c. java()
d. Hello()

8. Nonexecuting program statements that provide documentation are called


.
a. classes
b. notes
c. comments
d. commands
9. Which of the following is not a primitive data type in Java?
a. boolean
b. byte
c. int
d. sector

10. The assignment operatorin Java is .


a. =
b. ==
c. :=
d. ::
11. Assuming you have declared shoeSize to be a variable of type int, which of
the following is a valid assignment statement in Java?
a. shoeSize = 9;
b. shoeSize = 9.5;
c. shoeSize = '9';
d. shoeSize = "nine";

12. A boolean variable can hold .


a. any character
b. any whole number
c. any decimal number
d. the value true or false

13. The remainder operator .


a. is represented by a forward slash
b. must follow a division operation
c. provides the quotient of integer division
d. is none of the above
14. According to the rules of operator precedence, when division occurs in the
same arithmetic statement as , the division operation always takes
place first.
a. multiplication
b. remainder
c. subtraction
d. Answers a and b are correct.
15. The “equal to” relational operator is .
a. =
b. ==
c. !=
d. !!
16. In Java, what is the value of 3 + 7 * 4 + 2?
a. 21
b. 33
c. 42
d. 48
17. Which assignment is correct in Java?
a. int value = (float) 4.5;
b. float value = 4 (double);
c. double value = 2.12;
d. char value = 5c;

18. The code between a pair of curly braces in a method is a .


a. function
b. block
c. brick
d. sector
19. When a block exists within another block, the blocks are .
a. structured
b. nested
c. sheltered
d. illegal
20. The logical structure in which one instruction occurs after another with no
branching is a .
a. sequence
b. selection
c. loop
d. case
21. Which of the following is typically used in a flowchart to indicate a decision?
a. square
b. rectangle
c. diamond
d. oval

22. Which of the following is not a type of if statement?


a. single-alternative if
b. dual-alternative if
c. reverse if
d. nested if

23. A decision is based on a(n) value.


a. Boolean
b. absolute
c. definitive
d. convoluted

24. In Java, the value of (4 > 7) is .


a. 4
b. 7
c. true
d. false
25. Assuming the variable q has been assigned the value 3, which of the following
statements displays XXX?
a. if(q > 0) System.out.print.ln("XXX");
b. if(q > 7); System.out.println("XXX");
c. Both of the above statements display XXX.
d. Neither of the above statements displays XXX.

26. The operator that combines two conditions into a single Boolean value that is
true only when both of the conditions are true, but is false otherwise, is
.
a. $$
b. !!
c. ||
d. &&

27. The operator that combines two conditions into a single Boolean value that is
true when at least one of the conditions is true is .
a. $$
b. !!
c. ||
d. &&

28. Assuming a variable f has been initialized to 5, which of the following


statements sets g to 0?
a. if(f > 6 || f == 5) g = 0;
b. if(f < 3 || f > 4) g = 0;
c. if(f >= 0 || f < 2) g = 0;
d. All of the above statements set g to 0.

29. Assuming a variable y has been assigned the value 6, the value of !(y < 7)
is .
a. 6
b. 7
c. true
d. false

30. A structure that allows repeated execution of a block of statements is a..


a. cycle
b. loop
c. ring
d. band

31. A loop that never ends is a(n) loop.


a. iterative
b. infinite
c. structured
d. illegal
32. To construct a loop that works correctly, you should initialize a loop control .
a. variable
b. constant
c. structure
d. condition

33. If total = 100 and amt = 200, then after the statement total += amt.
a. total is equal to 200
b. total is equal to 300
c. amt is equal to 100
d. amt is equalto300

34. A sequence of characters enclosed within double quotation marks is a .


a. symbolic string
b. literal string
c. prompt
d. command

35. Joining Strings with a plus sign is called .


a. chaining
b. concatenation
c. parsing
d. linking

36. An array is a list of data items that .


a. all have the same type
b. all have different names
c. all are integers
d. all are null

37. For how many integers does the following statement reserve room?
int[] value = new int[34];
a. 0
b. 33
c. 34
d. 35

38 If you declare an array as follows, how do you indicate the final element of
the array?
int[] num = new int[6];
a. num[0]
b. num[5]
c. num[6]
d. impossible to tell
39. If you declare an integer array as follows, what is the value of num[2]?
int[] num = {101, 202, 303, 404, 505, 606};
a. 101
b. 202
c. 303
d. impossible to tell

40. Suppose you have declared an array as follows:


int[] creditScores = {670, 720, 815};
What is the value of creditScores.length?
a. 0
b. 1
c. 2
d. 3

What is the value of each of the following Boolean expressions?


41. 5 < 8
42. 4 <= 9
43. 3 == 4
44. 12 >= 12
45. 3 + 4 == 8
46. 7 < 9 − 2
47. 5 != 5
48. 15 != 3 * 5
49. 9 != − 9
50. 3 + 5 * 2 == 16

You might also like