if(5>10)
System.out.println("fan");
else if(8!=9) System.out.println("glass"); else System.out.println("Cream");
System.out.println("fan");
else if(8!=9) System.out.println("glass"); else System.out.println("Cream");
Anonymous Quiz
9%
Fan
45%
Glass
23%
Cream
23%
None of the mentioned
final class A{
int i=1;
} class B extends A{ int j=1; void display(){ System.out.println(i+" "+j); } } public class Program { public static void main(String[] args) { B b=new B(); b.display(); } }
int i=1;
} class B extends A{ int j=1; void display(){ System.out.println(i+" "+j); } } public class Program { public static void main(String[] args) { B b=new B(); b.display(); } }
Anonymous Poll
18%
1 1
12%
0 1
18%
Runtime Error
53%
Compilation Error
public class Program
{
public static void main(String[] args) { int sum=9; double data=444.324; float value=5.1f; System.out.println(data+sum+value); } }
{
public static void main(String[] args) { int sum=9; double data=444.324; float value=5.1f; System.out.println(data+sum+value); } }
Anonymous Quiz
11%
444.32495.1
11%
456
63%
458.4239999046326
16%
458.4
when you want the system to execute a command you almost never have to give the full path to that how can it be achieved?
Anonymous Quiz
41%
PATH environment variable take care of this
24%
The SYSTEM_PATH environment variable take care of this
29%
The commands which declared under /usr/bin/ don't need to use full path
6%
This isn't correct,you don't have to specify the full path unless you are located under the command
which command will you choose to copy all files and sub directories?
Anonymous Quiz
54%
cp
8%
mv
29%
cp-R
8%
cp-A
class Program
{
public static void main(String[] args) {
try{
badMethod();
System.out.println("A");
}catch(RuntimeException ex){
System.out.println("B");
}catch(Exception ex1){
System.out.println("C");
}
finally{
System.out.println("D");
}
System.out.println("E");
}
public static void badMethod(){
throw new RuntimeException();
}
}
A) BD
B) BCD
C) BDE
D) BCDE
{
public static void main(String[] args) {
try{
badMethod();
System.out.println("A");
}catch(RuntimeException ex){
System.out.println("B");
}catch(Exception ex1){
System.out.println("C");
}
finally{
System.out.println("D");
}
System.out.println("E");
}
public static void badMethod(){
throw new RuntimeException();
}
}
A) BD
B) BCD
C) BDE
D) BCDE
public class Program implements Runnable
{
private String holdA="This is";
private int[] holdB={1,2,3,4,5,6,7,8,9,10};
public static void main(String[] args) {
Program p=new Program();//Line6
(new Thread(p)).start();//Line7
(new Thread(p)).start();//Line8
}
public synchronized void run()//Line10{
for(int w=0;w<10;w++){
System.out.println(holdA+holdB[w]+".");
}
}
}
A) Compilation fails because of an error on Line 6
B)Compilation fails because of an error on Line 10
C)Compilation fails because of an error on Line 7 and 8
D) Compilation succeeds and the program print each value.
{
private String holdA="This is";
private int[] holdB={1,2,3,4,5,6,7,8,9,10};
public static void main(String[] args) {
Program p=new Program();//Line6
(new Thread(p)).start();//Line7
(new Thread(p)).start();//Line8
}
public synchronized void run()//Line10{
for(int w=0;w<10;w++){
System.out.println(holdA+holdB[w]+".");
}
}
}
A) Compilation fails because of an error on Line 6
B)Compilation fails because of an error on Line 10
C)Compilation fails because of an error on Line 7 and 8
D) Compilation succeeds and the program print each value.
public class Program{ public static void main(String[] args) {try{ badMethod();System.out.println("A");}catch(Exception e){System.out.println("B");}finally{System.out.println("C");
}System.out.println("D");
}public static void badMethod(){} }
}System.out.println("D");
}public static void badMethod(){} }
Anonymous Quiz
11%
AC
21%
BC
42%
ACD
26%
ABCD
A process that involves recognizing and focusing on the important characteristics of a situation or object is known as:
Anonymous Quiz
9%
Encapsulation
4%
Polymorphism
48%
Abstraction
9%
Inheritance
30%
Object persistence
Which statement is true regarding an object?
Anonymous Quiz
0%
An object is what classes instantiated are from
84%
An object is an instance of a class
12%
An object is a variable
4%
An object is a reference to an attribute
0%
An object is not an instance of a class
In object-oriented programming, composition relates to
Anonymous Quiz
19%
The use of consistent coding conventions
38%
The organization of components interacting to achieve a coherent, common behavior
29%
The use of inheritance to achieve polymorphic behavior
10%
The organization of components interacting not to achieve a coherent common behavior
5%
The use of data hiding to achieve polymorphic behavior
In object-oriented programming, new classes can be defined by extending existing classes. This is an example of:
Anonymous Quiz
17%
Encapsulation
13%
Interface
8%
Composition
58%
Inheritance
4%
Aggregation
Which of the following does not belong: If a class inherits from some other class, it should
Anonymous Quiz
9%
Make use of the parent class’s capabilities
32%
Over-ride or add the minimum to accomplish the derived class’ purpose
27%
Over-ride all the methods of its parent class
23%
Make sure the result “IS-A-KIND-OF” its base class
9%
Make sure the result “contains” its base class
Object-oriented inheritance models the
Anonymous Quiz
38%
“is a kind of” relationship
27%
“has a” relationship
12%
“want to be” relationship
19%
inheritance does not describe any kind of relationship between classes
4%
“contains” of relationship
The wrapping up of data and functions into a single unit is called
Anonymous Quiz
78%
Encapsulation
4%
Abstraction
15%
Data Hiding
0%
Polymorphism
4%
Message passing.
Given a class named student, which of the following is a valid constructor declaration for the class?
Anonymous Quiz
42%
Student (student s) { }
15%
Student student ( ) { }
19%
Private final student ( ) { }
12%
Void student ( ) { }
12%
Static void student(){ }
What is garbage collection in the context of Java?
Anonymous Quiz
10%
The operating system periodically deletes all of the java files available on the system
19%
Any package imported in a program and not used is automatically deleted
43%
When all references to an object are gone, the memory used by the object is automatically reclaimed
24%
The JVM checks the output of any Java program and deletes anything that doesn’t make sense
5%
When all references to an object are gone the memory used by the object is not reclaimed
The concept of multiple inheritances is implemented in Java by
I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces. III. Implementing two or more interfaces
I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces. III. Implementing two or more interfaces
Anonymous Quiz
11%
Only (II)
26%
(I) and (II)
42%
(II) and (III)
16%
Only (I)
5%
Only (III)
In Java, declaring a class abstract is useful
Anonymous Quiz
30%
To prevent developers from further extending the class
17%
When it doesn’t make sense to have objects of that class
30%
When default implementations of some methods are not desirable
22%
To force developers to extend the class not to use its capabilities
0%
When it makes sense to have objects of that class