
Java Quiz
Authored by Harris onaeshim
Other
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
3 mins • 2 pts
Who invented Java Programming?
Guido van Rossum
Dennis Ritchie
Bjarne Stroustrup
James Gosling
2.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
Which one of the following is not a Java feature?
Object-oriented
Dynamic and Extensible
Portable
Use of pointers
Answer explanation
Pointers is not a Java feature. Java provides an efficient abstraction layer for developing without using a pointer in Java. Features of Java Programming are Portable, Architectural Neutral, Object-Oriented, Robust, Secure, Dynamic and Extensible, etc.
3.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
Which of these cannot be used for a variable name in Java?
identifier & keyword
identifier
none of the mentioned
keyword
Answer explanation
Keywords are specially reserved words that can not be used for naming a user-defined variable, for example: class, int, for, etc.
4.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
What will be the output of the following Java code?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
32
33
25
24
Answer explanation
Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32.
output:
5.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
class output {
public static void main(String args[])
{
double a, b,c;
a = 3.0/0;
b = 0/4.0;
c=0/0.0;
System.out.println(a);
System.out.println(b);
System.out.println(c);
class output {
public static void main(String args[])
{
double a, b,c;
a = 3.0/0;
b = 0/4.0;
c=0/0.0;
System.out.println(a);
System.out.println(b);
System.out.println(c);
NaN
Infinity
0.0
all of the mentioned
Answer explanation
For floating point literals, we have constant value to represent (10/0.0) infinity either positive or negative and also have NaN (not a number for undefined like 0/0.0), but for the integral type, we don’t have any constant that’s why we get an arithmetic exception.
6.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
Which of the following is a type of polymorphism in Java Programming?
Multiple polymorphism
Compile Time Polymorphism
Mulitilevel Polymorphism
Execution time polymorphism
Answer explanation
There are two types of polymorphism in Java. Compile time polymorphism (overloading) and runtime polymorphism (overriding).
7.
MULTIPLE CHOICE QUESTION
3 mins • 2 pts
What will be the output of the following Java program?
class leftshift_operator
{
public static void main(String args[])
{
byte x = 64;
int i;
byte y;
i = x << 2;
y = (byte) (x << 2);
System.out.print(i + " " + y);
0 256
256 0
0 64
64 0
Answer explanation
Answer: c
Explanation: None.
output:
$ javac leftshift_operator.java $ java leftshift_operator 256 0
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Other
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University