
MAD2019JAVAQuiz
Computers
University
Used 2+ times

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 CHOICE QUESTION
30 sec • 1 pt
Which of the following is FALSE about abstract classes in Java
If we derive an abstract class and do not implement all the abstract methods, then the derived class should also be marked as abstract using 'abstract' keyword
Abstract classes can have constructors
A class can be made abstract without any abstract method
A class can inherit from multiple abstract classes.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is FALSE about arrays on Java
A java array is always an object
Length of array can be changed after creation of array
Arrays in Java are always allocated on heap
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output?
// file name: Main.java
public class Main {
public static void main(String args[]) {
int arr[] = {10, 20, 30, 40, 50};
for(int i=0; i < arr.length; i++)
{
System.out.print(" " + arr[i]);
}
}
}
10 20 30 40 50
Compiler Error
Run time Error
10 20 30 40
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output of following Java program.
class Test {
public static void main(String[] args) {
for(int i = 0; 0; i++)
{
System.out.println("Hello");
break;
}
}
}
Hello
Empty Output
Compiler error
Run time error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output of following Java program
class T {
int t = 20;
T() {
t = 40;
}
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
}
20
40
compiler error
run time error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Output of following Java program?
class Main {
public static void main(String args[]) {
int x = 0;
int y = 10;
int z = y/x;
}
}
compiler error
compiles and runs fine
Compiles fine but throws Arithmetic Exception exception
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is/are true about packages in Java?
1) Every class is part of some package.
2) All classes in a file are part of the same package.
3) If no package is specified, the classes in the file
go into a special unnamed package
4) If no package is specified, a new package is created with
folder name of class and the class is put in this package.
Only 1, 2 and 3
Only 1,2 and 4
only 1
non of the above
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?