Font size
WorksheetsJava quiz-2024-Sec-B
Total questions: 12
Worksheet time: 10mins
USN
NAME
What will be the output of the code give below:
class yes
{
public static void main(String[] args)
{
int Integer = 24;
char String = 'I';
System.out.print(Integer);
System.out.print(String);
}}
24I
24
Compiler error
Runtime Error
Which of the following is not a Java feature?
Object-oriented
Use of pointers
Portable
Dynamic and Extensible
Java Implements Runtime Polymorphism through
method overloading
method overriding
Dynamic method Dispatch
none of the above
is used to resolve name space collisions
super
object
This
all of the above
What will be the output of the following code
public void method(double a)
{
System.out.println("Method called");
}
public static void main()
{ method(2);
}
Method called
compilation error
runtime error
none of the above
Given that Student is a class, how many reference variables and objects are created by the following code?
Student studentName, studentId;
studentName = new Student();
Student stud_class = new Student();
Three reference variables and two objects are created.
Two reference variables and two objects are created.
One reference variable and two objects are created.
Three reference variables and three objects are created.
Find the output of the following program.
public class Solution
{ public static void main(String[] args)
{
int[] x = {120, 200, 016};
for(int i = 0; i < x.length; i++)
{ System.out.print(x[i] + “ “);
}
}
}
120 200 016
120 200 14
120 200 16
When an array is passed to a method, what does the method receive?
Length of the array
copy of the array
Reference of the array
all of the above
is the mechanism by which a call to overridden method is resolved at runtime
method overloading
Dynamic method dispatch
method overriding
method hiding
Identify the corrected definition of a package.
A package is a collection of editing tools
A package is a collection of classes and interfaces
A package is a collection of interfaces
A package is a collection of classes
