NEW
Font size
Worksheets10211CS204 -OOPS using Java
Total questions: 15
Worksheet time: 15mins
Which of the following option leads to the portability and security of Java?
Bytecode is executed by JVM
The applet makes the Java code secure and portable
Use of exception handling
Dynamic binding between objects
Which of the following is not a Java features?
Dynamic
Architecture Neutral
Use of pointers
Object-oriented
Which of the following for loop declaration is not valid?
for ( int i = 99; i >= 0; i / 9 )
for ( int i = 7; i <= 77; i += 7 )
for ( int i = 20; i >= 2; - -i )
for ( int i = 2; i <= 20; i = 2* i )
Which method of the Class.class is used to determine the name of a class represented by the class object as a String?
getClass()
intern()
getName()
toString()
Which package contains the Random class?
Which option is false about the final keyword?
A final method cannot be overridden in its subclasses.
A final class cannot be extended.
A final class cannot extend other classes.
A final method can be inherited.
Which of the following is a type of polymorphism in Java Programming?
Multiple polymorphism
Compile time polymorphism
Multilevel polymorphism
Execution time polymorphism
What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");
}
}
1 2 3 4 5
1 2 3 4
1 2
1 2 3
Which of these keywords is used to define interfaces in Java?
intf
Intf
interface
Interface
Which of the following is a superclass of every class in Java?
ArrayList
Abstract class
Object class
String
Which of these class is superclass of String and StringBuffer class?
java.util
java.lang
ArrayList
None of the mentioned
Which of this method of class String is used to obtain a length of String object?
get()
Sizeof()
lengthof()
length()
Which of these constructors is used to create an empty String object?
String()
String(void)
String(0)
None of the mentioned
What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}
a
b
c
abc
Which of these operators can be used to concatenate two or more String objects?
+
+=
&
II
