2
Q:

main() {

int i;

printf("%d",scanf("%d",&i)); // value 10 is given as input here

}

A) 1 B) 2
C) 3 D) 4

Answer:   A) 1



Explanation:

Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

Subject: Java
Q:

An algorithm written once which can be used in many places is called

A) Block B) Function
C) Datatype D) None
 
Answer & Explanation Answer: B) Function

Explanation:

Function is an algorithm which can be used any where in the program when required

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2462
Q:

What are the 3main tasks of JVM?

Answer

The JVM performs three main tasks:


• Loads code


• Verifies code


• Executes code

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1676
Q:

By whom will the unallocated memory that is no longer needed will be cleared in java?

A) Java Virtual Machine B) Garebage collector
C) Both A and B D) None
 
Answer & Explanation Answer: B) Garebage collector

Explanation:

The Java programming language provides a system-level thread to track memory allocation.

Garbage collection has the following characteristics:

• Checks for and frees memory no longer needed

• Is done automatically

• Can vary dramatically across JVM implementations

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2655
Q:

Keeping the actoins and attributes together under a single unit is called 

A) Encapsulation B) Information Hiding
C) Polymorphism D) Inheritance
 
Answer & Explanation Answer: A) Encapsulation

Explanation:

Encapsulation is a process of binding the data objects together under a single unit.It is one ofthe elements of oops

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2723
Q:

How many of the following will follow JavaBean Listener naming rules?

addListener

addMouseListener

deleteMouseListener

removeMouseListener

registerMouseListener

 

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: B) 2

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Java

0 18530
Q:

Which king class properly represents the relationship "King has a best friend who is a Soldier"?

A) class King extends Soldier { } B) class King implements Soldier { }
C) class King { private BestFriend Soldier; } D) class King { private Soldier bestFriend; }
 
Answer & Explanation Answer: D) class King { private Soldier bestFriend; }

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2496
Q:

How is final different from finally and finalize()?

Answer final is a modifier which can be applied to a class or a method or a variable. final class can't be inherited, final method can't be overridden and final variable can't be changed.

finally is an exception handling code section which gets executed whether an exception is raised or not by the try block code segment.

finalize() is a method of Object class which will be executed by the JVM just before garbage collecting object to give a final chance for resource releasing activity.
Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1883
Q:

Can you give few examples of final classes defined in Java API?

Answer

java.lang.String,  java.lang.Math are final classes.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

6 8358