Test your knowledge of core Java concepts
One of the most popular programming languages of the past few decades is Java. Java, which hit a momentous milestone in 2015, provides the foundation on which so much else is built and makes the web we interact with today possible.
The answers appear at the end of the questions. In all cases, pick the best answer(s) to each question. Good luck!
1. Which of the following reads Java code before it runs and makes sure that it obeys basic rules of the language – can’t violate access permission on objects, etc.?
A. Class loader
B. Bytecode verifier
C. Java interpreter
D. Sandbox manager
2. Which of the following components of the core Java API lets you write server-side applications?
3. Which of the following can be used to pass command-line arguments to the application?
A. Command strings
B. String args
4. In the code you are writing, it is conceivable the user will type in a value that is a date in a particular field but it could also be a string value. What can you use in Java to work with to “switch” between two types of data?
5. Within Java, the command B++ is the same as which of the following?
A. B = B + B
B. B = B * B
C. B = B + 1
D. B = mod(B)
6. In Java, functions are known as:
7. Which of the following operations returns a value of false?
A. 9 ==9
B. 9 <= 9
C. 9 != 9
D. 9 >= 9
8. What is the difference, in Java, between a while loop and a do-while loop?
A. The loop-continuation condition is not checked the first time through the loop.
B. The former existed in earlier versions of Java but has been replaced by the latter in newer versions.
C. The latter only works when a condition is false, while the former only works while the condition is true.
D. There is no difference between the two loops.
9. What value will be returned from the following code:
Math.sqrt(8.0*8.0 – 6.0*8.0)
10. Which of the following companies developed Java?
B. Silicon Graphics International
C. Bell Labs
D. Sun Microsystems
11. With Java, which of the following can be used to find all occurrences of “Sun” but not within “Sunday”?
12. Which three of the following are accepted filename extensions in Java (choose three)?
13. Given the following snippet of code, what is the value of variable B at its conclusion?
String F, S, B;
F = “7”;
S = “5”;
B = F + S;
14. You have just been assigned a new boss who hasn’t been directly over programming for some time. He tells you that he would like to see some code changed to include a ternary operator to handle whatever condition the user generates. Within Java, what is the correct coding for this?
A. (condition : result1 : result2 )
B. (condition ? result1 : result2 )
C. (condition ? result1 ? result2 )
D. (condition : result1 ? result2 )
15. Which of the following classes proves the framework for user interface components?
Please visit GoCertify to attempt the remaining 10 questions of this quiz.
12. A, B, and C