Explore topic-wise MCQs in Csharp.

This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Csharp knowledge and support exam preparation. Choose a topic below to get started.

1.

What is the output of the below Java program that tries to overload a method "abs"?

A. No output
B. Compiler error
C. 10, 4.56, 10.123
D. -10, -4.56, -10.123
Answer» D. -10, -4.56, -10.123
2.

Which is the overloaded static method of Math class to get absolute value in Java?

A. Math.abs(int)
B. Math.abs(float)
C. Math.abs(double)
D. All the above
Answer» E.
3.

Java method overloading implements the OOPS concept ___.

A. Inheritance
B. Polymorphism
C. Encapsulation
D. None
Answer» C. Encapsulation
4.

What is the output of the below Java program trying to overload a method "jump"?

A. Rabbit Jump
B. Wild Rabbit Jump
C. Compiler error
D. None
Answer» D. None
5.

What is the output of the below Java program with method overloading?

A. PINE
B. TEAK
C. Compiler error
D. None
Answer» C. Compiler error
6.

To successfully overload a method in Java, the method names must be ___.

A. Same
B. Different
C. Same or different
D. None
Answer» B. Different
7.

What is the output of the below Java program with multiple methods?

A. JIM JAM
B. KING KONG
C. KING KONG
D. compiler error
Answer» D. compiler error
8.

To successfully overload a method in Java, the argument-list or parameter-list must be ___.

A. Same
B. Different
C. -
D. -
Answer» C. -
9.

To successfully overload a method in Java, the return types must be ___.

A. Same
B. Different
C. Same but using superclass or subclass types also work
D. None
Answer» D. None
10.

Which among the following is true?

A. The constructors overloading can be done by using different names
B. The constructors overloading can be done by using different return types
C. The constructors can be overloaded by using only one argument
D. The constructors must have same name as that of class
Answer» E.
11.

Which casting among the following is allowed for the code given below?

A. Casting 1
B. Casting 2
C. casting 1 and casting 2
D. casting 1 nor casting 2
Answer» C. casting 1 and casting 2
12.

The using declaration __________

A. Doesn’t carry over the default values
B. Carries over the known default arguments
C. Carries over only the normal arguments
D. Carries over only few default arguments
Answer» C. Carries over only the normal arguments
13.

Which among the following is true ?

A. More than one constructors with all default arguments is allowed
B. More than one constructors with all default arguments can be defined outside the class
C. More than one constructors can be used with same argument list
D. More than one constructors with all default arguments can’t exist in same class
Answer» E.
14.

How many parameters must be passed if only the following prototype is given to a constructor?Prototype: className(int x, int y, int z=0);

A. 1
B. 2
C. 3
D. Compile time error
Answer» C. 3
15.

The Constructors with all the default arguments are similar as default constructors. State true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False