5
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:

Which is true?

A) "X extends Y" is correct if and only if X is a class and Y is an interface B) "X extends Y" is correct if and only if X is a class and Y is an interface
C) "X extends Y" is correct if X and Y are either both classes or both interfaces D) "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces
 
Answer & Explanation Answer: C) "X extends Y" is correct if X and Y are either both classes or both interfaces

Explanation:

A is incorrect because classes implement interfaces, they don't extend them. B is incorrect because interfaces only "inherit from" other interfaces. D is incorrect based on the preceding rules.

Report Error

View Answer Report Error Discuss

Filed Under: Java

2 6026
Q:

Which key word is to be used to tell the JVM to skip the variable while performing the serialization process of the object containing it?

A) Transcient B) Volatile
C) Static D) Final
 
Answer & Explanation Answer: A) Transcient

Explanation:

If you mark an instance variable as transient, you're telling the JVM to skip (ignore) this variable when you attempt to serialize the object containing it.

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2387
Q:

The keyword which indicates that a method can be accessed by only one thread at a time is

A) Strictfp B) Synchronized
C) New D) None
 
Answer & Explanation Answer: B) Synchronized

Explanation:

The synchronized keyword indicates that a method can be accessed by only one thread at a time

Report Error

View Answer Report Error Discuss

Filed Under: Java

2 3284
Q:

In a single virtual machine, the Java programming language passes arguments by

A) Refference B) Value
C) Both A and B D) None
 
Answer & Explanation Answer: B) Value

Explanation:

In single virtual machine,JVM passes arguments only by value.

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2178
Q:

Which of the following is not used for commenting in java?

A) // B) /* */
C) /** */ D) /** **/
 
Answer & Explanation Answer: D) /** **/

Explanation:
  • //               is a single line comment
  • /*  */          is commenting on one or more lines
  • /** */         is documentation comment
Report Error

View Answer Report Error Discuss

Filed Under: Java

1 3161
Q:

Which of the following is not the other name of attriibute?

A) Data member B) Instance variable
C) instance D) Data filed
 
Answer & Explanation Answer: C) instance

Explanation:

Instance is an object not an attribute

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2195
Q:

There is one default constructor in every class.

A) The above statement is true B) The above statement is false
C) Both true and false D) None
 
Answer & Explanation Answer: A) The above statement is true

Explanation:

There will always be a default constructor in every class 

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 3274
Q:

Client code having direct access to internal data is called

A) Encapsulation B) DataHiding
C) Polymorphism D) DataAbstraction
 
Answer & Explanation Answer: B) DataHiding

Explanation:

Client code must use setters and getters to access internal data in DataHiding

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2015