Explore topic-wise MCQs in Csharp.

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

1.

Java allows calling or invoking a method from a constructor. State TRUE or FALSE.

A. TRUE
B. FALSE
C. -
D. -
Answer» B. FALSE
2.

Java constructor overloading follows ___ principle in Object-Oriented programming.

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

Choosing a suitable overloaded constructor happens at ___ time in Java.

A. Compile-time
B. Run time
C. -
D. -
Answer» C. -
4.

What is the output of the below Java program with many constructors?

A. Book=50
B. Pen=50.5
C. Compiler error
D. None of the above
Answer» C. Compiler error
5.

Choose the correct way of calling the second constructor from the first constructor in the below code options.

A. Constructor5()
B. Constructor5()
C. Constructor5()
D. All the above
Answer» D. All the above
6.

In Java, you can pass __ variables from one constructor to another overloaded constructor.

A. local variables
B. static variables
C. non-static variables
D. local and static variables
Answer» E.
7.

What is the output of the below Java program with overloaded constructors?

A. Birds=0
B. Birds=10
C. Birds=20
D. Compiler error
Answer» D. Compiler error
8.

A constructor can call another overloaded constructor using the ___ keyword in Java.

A. super
B. local
C. con
D. this
Answer» E.
9.

What is the output of the below Java program with constructors?

A. Count=0
B. Count=10
C. Compiler error
D. None of the above
Answer» D. None of the above
10.

Overloading of constructors in Java means adding more than ___ constructors with the different argument list.

A. 1
B. 2
C. 3
D. 8
Answer» B. 2
11.

The compiler adds a default no-argument constructor to a class if it ___.

A. does not define a constructor at all.
B. defines at least one constructor with arguments
C. -
D. -
Answer» B. defines at least one constructor with arguments
12.

In Java, a constructor with one or more arguments or parameters is called a ___ constructor.

A. Default constructor
B. User-defined constructor or Non-default constructor
C. -
D. -
Answer» C. -
13.

In Java, a constructor with no parameters or no arguments is called ___ constructor.

A. Default constructor
B. User-defined constructor
C. -
D. -
Answer» B. User-defined constructor
14.

Memory is allocated to an object once the execution of ___ is over in Java language.

A. main method
B. constructor
C. destructor
D. None
Answer» C. destructor
15.

The purpose of a Java constructor is ___.

A. Initialization of variables with passed data
B. Writing custom code
C. Accepting other objects as inputs
D. All the above
Answer» E.
16.

The placement of a constructor inside a class should be ___.

A. Always at the beginning of class
B. Always at the end of class
C. Anywhere in the class
D. None
Answer» D. None
17.

The name of a constructor and the name of a class are ___.

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

A Java constructor is like a method without ___.

A. statements
B. return type
C. argument list
D. None
Answer» C. argument list
19.

4,_26,_144?$

A. 26, 4, 144
B. 144, 26, 4
C. 0, 0, 0
Answer» D.
20.

hello bye

A. 12 hello
B. bye 12
C. Compile time error
Answer» D.
21.

8, 8

A. 0, 2
B. 8, 10
C. 7, 8
Answer» B. 8, 10