
Java Quiz-1
Authored by Ananth Kumar
Computers
Professional Development
Used 12+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of this program?
class evaluate
{
public static void main(String args[])
{
int a[] = {1,2,3,4,5};
int d[] = a;
int sum = 0;
for (int j = 0; j < 3; ++j)
sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
System.out.println(sum);
}
}
38
39
40
41
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this program?
class variable_scope
{
public static void main(String args[])
{
int x;
x = 5;
{
int y = 6;
System.out.print(x + " " + y);
}
System.out.println(x + " " + y);
}
}
5 6 5 6
5 6 5
Runtime error
Compilation error
3.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
When does method overloading is determined?
At run time
At compile time
At coding time
At execution time
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is it called if an object has its own lifecycle and there is no owner?
Aggregation
Composition
Encapsulation
Association
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is it called where child object gets killed if parent object is killed?
Aggregation
Composition
Encapsulation
Association
6.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
Which of the following is a valid declaration of an object of class Box?
Box obj = new Box();
Box obj = new Box;
obj = new Box();
new Box obj
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this program?
class main_class
{
public static void main(String args[])
{
int x = 9;
if (x == 9)
{
int x = 8;
System.out.println(x);
}
}
}
9
8
Compilation error
Runtime error
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?
Similar Resources on Wayground
16 questions
Applied Networking
Quiz
•
12th Grade - Professi...
16 questions
De todo
Quiz
•
1st Grade - Professio...
17 questions
JavaScript 2
Quiz
•
Professional Development
15 questions
Tipos de datos y variables
Quiz
•
Professional Development
17 questions
SQL - parte 1
Quiz
•
Professional Development
15 questions
JF UIT 2022 - Game 2
Quiz
•
Professional Development
15 questions
CodeHS - Intro to Python - Conditionals Quiz
Quiz
•
9th Grade - Professio...
15 questions
Network Plus Pre Assessment
Quiz
•
Professional Development
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 Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...