Long Quiz in Computer Programming (Java Nciii)
Long Quiz in Computer Programming (Java Nciii)
A. Byte
B. Short
C. Long
D. Char
18. Which of the following is an invalid first
character of an identifier?
A. _
B. $
C. A
D. 8
19. Which of the following means that in order
for the conditional to happen, either x must be
less than 3 or y must be greater than or equal
to 4?
A. if ((x < 3) && (y > 4))
B. if (x < 3 y >= 4)
C. if ((x < 3) || (y > = 4))
D. if ((x > 3) || (y < = 4))
20. Which symbol is used to denote a multi-
line comment?
A. / /
B. /* */
C. { }
D. < >
21. What is the smallest unit of
measurement used to quantify computer
data.
A.terabyte
B. bit
C. byte
D.gigabyte
22. It is the Java keyword that creates
inheritance.
A. Enlarge
B. Extends
C. Inherits
D. Inheritance
23. It is the code/s inside a pair of curly
braces.
A. Block
B. Brick
C. Function
D. Method
24. It is the rules of a programming
language.
A. Format
B. Logic
C. Object
D. Syntax
25. A list of instructions that enable a
computer to perform a specific task is a...
A.Computer Program
B. Algorithm
C. Machine Code
D.Binary Code
26. How many times will the following code print “Hello
World"?
int count = 0;
while (count < 10) {
System.out.println(“Hello World");
count++;
}
A. 8
B. 9
C. 10
D. 0
27. The following loop displays______________.
for (int i = 1; i <= 10; i++) {
System.out.print(i + " ");
i++;
}
A. 1 2 3 4 5 6 7 8 9
B. 1 2 3 4 5 6 7 8 9 10
C. 1 2 3 4 5
D. 1 3 5 7 9
28. What is returned by values[7]?
A. 9
B. 12
C. 6
D. error
29. The range of indices for an array always
start at:
A. A glitch
B. A hack
C. A bug
D. A code
32. If we declare int [ ] ar = {1,2,3,4,5,6}; The
size of array ar is:
A. 0
B. 5
C. 6
D. 7
33. Object-Oriented Programming means ...
A. Being objective about what you develop
B. Designing the application based on the objects
discovered when analysing the problem
C. Writing an algorithm before writing your program
and having a test plan
D. Writing a program composed of Java classes
34. An array holds:
A. Int
B. String
C. Double
D. Boolean
37. Choose the appropriate data type for this
value: true
A. Int
B. Double
C. String
D. Boolean
38. Choose the appropriate data type for this
value: 1
A. Int
B. Double
C. String
D. Boolean
39. Choose the appropriate data type for this
value: 5.5
A. Int
B. Double
C. Boolean
D. String
40. Choose the appropriate data type for this
value: ‘A’
A. Int
B. Char
C. Boolean
D. String
41. Which of the following always need a
Capital letter ?
A. Class names and Strings
B. Objects and class names
C. Fields and Strings
D. Data types and fields
42. What is the keyword used in java to
create an object?
A. This
B. New
C. Sync
D. New()
43. What is the correct syntax for java
main method?
A. Public void main(String[] args)
B. Public static void main(string[] args)
C. Public static void main()
D. None of the above
44. Java runs on _______.
A. Windows
B. Unix/Linux
C. Mac
D. All of the Above
45. Which of the following individuals is
credited for first designing Java?
A.Tim Ritchey
B. James Gosling
C. Jim LeValley
D.Ian Sheeler
46. What is the main function of any
variable ?
A. To add numbers together
B. To keep track of data in the memory of the
computer
C. To print words on the screen
D. To write Java codes
47. What is the proper way to declare a
variable ?
A. VariableName variableType;
B. VariableName;
C. VariableType;
D. VariableType variableName;
48. What is an assignment statement ?
A. Adding a number to an int
B. Assigning a multiplication
C. Assigning a name to a variable
D. Assigning a value to a variable
49. If you want your conditional to depend on two
conditions BOTH being true, what is the proper
notation to put between the two Boolean
statements?
A. &
B. &&
C. |
D. ||
50. Which is NOT a section of all types of
loops ?
A. Initialization
B. Loop Body
C. Test statement
D. The word "while"
Using the declaration below, what will be the final
element of the array? int [ ] grades = new int[35];
A. Grades[0]
B. Grades[34]
C. Grades[35]
D. Impossible to tell
If A=10, then after B=++A, the value of B is
_______.
A. 10
B. 11
C. 12
D. 13
It terminates every line of code in Java.
A. }
B. )
C. ;
D. .
Which is the first program run on a computer
when the computer boots up?
A. System software
B. Operating system
C. System operations
D. None
What is a Computer System made up of?