Explore topic-wise MCQs in Engineering.

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

51.

Which of the following is the incorrect form of Decision Control instruction?

A. <pre><code class="csharp">if (Condition1) {// Some statement}</code></pre>
B. <pre><code class="csharp">if (Condition1) {// Some statement} else {// Some statement}</code></pre>
C. <pre><code class="csharp">if (Condition1) {// Some statement} else {// Some statement} else if ( Condition2){//Some statement}</code></pre>
D. <pre><code class="csharp">if ( Condition1 ) {// Some statement} else if ( Condition2 ) {// Some statement} else {// Some statement}</code></pre>
E. <pre><code class="csharp">if ( Condition1 ) {// Some statement} else if ( Condition2 ) {// Some statement} else if ( Condition3 ) {// Some statement} else {// Some statement}</code></pre>
Answer» D. <pre><code class="csharp">if ( Condition1 ) {// Some statement} else if ( Condition2 ) {// Some statement} else {// Some statement}</code></pre>
52.

Which of the following can be used to terminate a while loop and transfer control outside the loop? exit while continue exit statement break goto

A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5
E. None of these
Answer» E. None of these
53.

What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class SampleProgram { static void Main(string[ ] args) { int i; int res = fun(out i); Console.WriteLine(res); } static int fun (out int i) { int s = 1; i = 7; for(int j = 1; j &lt;= i; j++) { s = s * j; } return s; } } }

A. 1
B. 7
C. 8
D. 720
E. 5040
Answer» F.
54.

If a function fun() is to sometimes receive an int and sometimes a double then which of the following is the correct way of defining this function?

A. <pre><code class="csharp">static void fun(object i) { ... }</code></pre>
B. <pre><code class="csharp">static void fun(int i) { ... }</code></pre>
C. <pre><code class="csharp">static void fun(double i, int j) { ... }</code></pre>
D. <pre><code class="csharp">static void fun(int i, double j) { ... }</code></pre>
E. <pre><code class="csharp">static void fun(int i, double j, ) { ... }</code></pre>
Answer» B. <pre><code class="csharp">static void fun(int i) { ... }</code></pre>
55.

Which of the following statements are correct about subroutines used in C#.NET? If we do not return a value from a subroutine then a value -1 gets returned. Subroutine definitions cannot be nested. Subroutine can be called recursively. To return the control from middle of a subroutine exit subroutine should be used. Subroutine calls can be nested.

A. 1, 2, 3
B. 2, 3, 5
C. 3, 5
D. 3, 4
E. None of these
Answer» C. 3, 5
56.

How many values is a subroutine capable of returning?

A. Depends upon how many params arguments does it use.
B. Any number of values.
C. Depends upon how many ref arguments does it use.
D. 0
E. 1
Answer» E. 1
57.

If a procedure fun() is to receive an int, a Single &amp; a double and it is to return a decimal then which of the following is the correct way of defining this procedure?

A. <pre><code class="csharp">fun(int i, Single j, double k) decimal { ... }</code></pre>
B. <pre><code class="csharp">static decimal fun(int i, Single j, double k) { ... }</code></pre>
C. <pre><code class="csharp">fun(int i, Single j, double k) { ... return decimal; }</code></pre>
D. <pre><code class="csharp">static decimal fun(int i, Single j, double k) decimal { ... }</code></pre>
E. A procedure can never return a value.
Answer» F.
58.

If a function fun() is to receive an int, a Single &amp; a double and it is to return a decimal then which of the following is the correct way of defining this function?

A. <pre><code class="csharp">decimal static fun(int i, Single j, double k) { ... }</code></pre>
B. <pre><code class="csharp">decimal fun(int i, Single j, double k) { ... }</code></pre>
C. <pre><code class="csharp">static decimal fun(int i, Single j, double k) { ... }</code></pre>
D. <pre><code class="csharp">static decimal fun(int i, Single j, double k) decimal { ... }</code></pre>
E. <pre><code class="csharp">static fun(int i, Single j, double k) { ... return decimal; }</code></pre>
Answer» D. <pre><code class="csharp">static decimal fun(int i, Single j, double k) decimal { ... }</code></pre>
59.

Which of the following is the correct way to rewrite the following C#.NET code snippet given below? int i = 0; do { Console.WriteLine(i); i+ = 1; } while (i &lt;= 10);

A. <pre><code class="csharp">int i = 0; do { Console.WriteLine(i); } until (i &lt;= 10);</code></pre>
B. <pre><code class="csharp">int i; for (i = 0; i &lt;= 10 ; i++) Console.WriteLine(i);</code></pre>
C. <pre><code class="csharp">int i = 0; while (i &lt;= 11) { Console.WriteLine(i); i += 1; }</code></pre>
D. <pre><code class="csharp">int i = 0; do while ( i &lt;= 10) { Console.WriteLine(i); i += 1; }</code></pre>
E. <pre><code class="csharp">int i = 0; do until (i &lt;= 10) { Console.WriteLine(i); i+=1; }</code></pre>
Answer» C. <pre><code class="csharp">int i = 0; while (i &lt;= 11) { Console.WriteLine(i); i += 1; }</code></pre>
60.

A function returns a value, whereas a subroutine cannot return a value.

A. True
B. False
Answer» B. False
61.

Which of the following will be the correct output for the C#.NET program given below? namespace IndiabixConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main() { Sample x = new Sample(); x.i = 10; fun(x); Console.Write(x.i + " "); } static void fun(Sample y) { y.i = 20; Console.Write(y.i + " "); } } }

A. 10 20
B. 10 10
C. 20 10
D. 20 20
E. None of the above
Answer» D. 20 20
62.

Which of the following statements are correct about a namespace used in C#.NET? Classes must belong to a namespace, whereas structures need not. Every class, struct, enum, delegate and interlace has to belong to some or the other namespace. All elements of the namespace have to belong to one file. If not mentioned, a namespace takes the name of the current project. The namespace should be imported to be able to use the elements in it.

A. 1, 3
B. 2, 4, 5
C. 3, 5
D. 4 only
Answer» C. 3, 5
63.

If ListBox is class present in System.Windows.Forms namespace, then which of the following statements are the correct way to create an object of ListBox Class? using System.Windows.Forms; ListBox lb = new ListBox(); using LBControl = System.Windows.Forms; LBControl lb = new LBControl(); System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox(); using LBControl lb = new System.Windows.Forms.ListBox; using LBControl = System.Windows.Forms.ListBox; LBControl lb = new LBControl();

A. 1, 3
B. 2, 4, 5
C. 1, 3, 5
D. 5 only
Answer» D. 5 only
64.

Which of the following CANNOT belong to a C#.NET Namespace?

A. class
B. struct
C. enum
D. Data
E. interface
Answer» E. interface
65.

Which of the following statements is correct about a namespace used in C#.NET?

A. Nested namespaces are not allowed.
B. Importing outer namespace imports inner namespace.
C. Nested namespaces are allowed.
D. If nested, the namespaces cannot be split across files.
Answer» D. If nested, the namespaces cannot be split across files.
66.

If a class called Point is present in namespace n1 as well as in namespace n2, then which of the following is the correct way to use the Point class?

A. <pre><code class="csharp">namespace IndiabixConsoleApplication { class MyProgram { static void Main(string[] args) { import n1; Point x = new Point(); x.fun(); import n2; Point y = new Point(); y.fun(); } } }</code></pre>
B. <pre><code class="csharp">import n1; import n2; namespace IndiabixConsoleApplication { class MyProgram { static void Main(string[] args) { n1.Point x = new n1.Point(); x.fun(); n2.Point y = new n2.Point(); y.fun(); } } }</code></pre>
C. <pre><code class="csharp">namespace IndiabixConsoleApplication { class MyProgram { static void Main(string[] args) { using n1; Point x = new Point(); x.fun(); using n2; Point y = new Point(); y.fun(); } } }</code></pre>
D. <pre><code class="csharp">using n1; using n2; namespace IndiabixConsoleApplication { class MyProgram { static void Main(string[] args) { n1.Point x = new n1.Point(); x.fun(); n2.Point y = new n2.Point(); y.fun(); } } }</code></pre>
Answer» E.
67.

Which of the following statements is correct about namespaces in C#.NET?

A. Namespaces can be nested only up to level 5.
B. A namespace cannot be nested.
C. There is no limit on the number of levels while nesting namespaces.
D. If namespaces are nested, then it is necessary to use using statement while using the elements of the inner namespace.
E. Nesting of namespaces is permitted, provided all the inner namespaces are declared in the same file.
Answer» D. If namespaces are nested, then it is necessary to use using statement while using the elements of the inner namespace.
68.

Which of the following is NOT a namespace in the .NET Framework Class Library?

A. <i class="csharp-code">System.Process</i>
B. <i class="csharp-code">System.Security</i>
C. <i class="csharp-code">System.Threading</i>
D. <i class="csharp-code">System.Drawing</i>
E. <i class="csharp-code">System.Xml</i>
Answer» B. <i class="csharp-code">System.Security</i>
69.

Which of the following statments are the correct way to call the method Issue() defined in the code snippet given below? namespace College { namespace Lib { class Book { public void Issue() { // Implementation code } } class Journal { public void Issue() { // Implementation code } } } } College.Lib.Book b = new College.Lib.Book(); b.Issue(); Book b = new Book(); b.Issue(); using College.Lib; Book b = new Book(); b.Issue(); using College; Lib.Book b = new Lib.Book(); b.Issue(); using College.Lib.Book; Book b = new Book(); b.Issue();

A. 1, 3
B. 2, 4
C. 3
D. 4, 5
Answer» B. 2, 4
70.

A derived class can stop virtual inheritance by declaring an override as

A. <i class="csharp-code">inherits</i>
B. <i class="csharp-code">extends</i>
C. <i class="csharp-code">inheritable</i>
D. <i class="csharp-code">not inheritable</i>
E. <i class="csharp-code">sealed</i>
Answer» F.
71.

Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?

A. <i class="csharp-code">new</i>
B. <i class="csharp-code">base</i>
C. <i class="csharp-code">overloads</i>
D. <i class="csharp-code">override</i>
E. <i class="csharp-code">overridable</i>
Answer» B. <i class="csharp-code">base</i>
72.

Which of the following operators cannot be overloaded? true false new ~ sizeof

A. 1, 3
B. 2, 4
C. 3, 5
D. All of the above
Answer» D. All of the above
73.

Which of the following should be used to implement a 'Has a' relationship between two entities?

A. Polymorphism
B. Templates
C. Containership
D. Encapsulation
E. Inheritance
Answer» D. Encapsulation
74.

Which of the following are reuse mechanisms available in C#.NET? Inheritance Encapsulation Templates Containership Polymorphism

A. 1, 4
B. 1, 3
C. 2, 4
D. 3, 5
Answer» B. 1, 3
75.

Which of the following statements are true about the C#.NET code snippet given below? String s1, s2; s1 = "Hi"; s2 = "Hi"; String objects cannot be created without using new. Only one object will get created. s1 and s2 both will refer to the same object. Two objects will get created, one pointed to by s1 and another pointed to by s2. s1 and s2 are references to the same object.

A. 1, 2, 4
B. 2, 3, 5
C. 3, 4
D. 2, 5
Answer» C. 3, 4
76.

Which of the following statements are correct about an enum used inC#.NET? By default the first enumerator has the value equal to the number of elements present in the list. The value of each successive enumerator is decreased by 1. An enumerator contains white space in its name. A variable cannot be assigned to an enum element. Values of enum elements cannot be populated from a database.

A. 1, 2
B. 3, 4
C. 4, 5
D. 1, 4
Answer» D. 1, 4
77.

Which of the following is the correct way to apply an attribute to an Assembly?

A. <i class="csharp-code">[ AssemblyDescription("DCube Component Library") ]</i>
B. <i class="csharp-code">[ assembly : AssemblyDescription("DCube Component Library") ]</i>
C. <i class="csharp-code">[ Assemblylnfo : AssemblyDescription("DCube Component Library") ]</i>
D. <i class="csharp-code">&lt; Assembly: AssemblyDescription("DCube Component Library") &gt;</i>
E. <i class="csharp-code">(Assembly: AssemblyDescription("DCube Component Library"))</i>
Answer» C. <i class="csharp-code">[ Assemblylnfo : AssemblyDescription("DCube Component Library") ]</i>
78.

Which of the following is the correct way of applying the custom attribute called Tested which receives two-arguments - name of the tester and the testgrade? Custom attribute cannot be applied to an assembly. [assembly: Tested("Sachin", testgrade.Good)] [Tested("Virat", testgrade.Excellent)] class customer { /* .... */ } Custom attribute cannot be applied to a method. Custom attribute cannot be applied to a class.

A. 1 only
B. 1, 5
C. 2, 3
D. 4, 5
E. None of the above
Answer» D. 4, 5
79.

Which of the following are necessary for Run-time Polymorphism? The overridden base method must be virtual, abstract or override. Both the override method and the virtual method must have the same access level modifier. An override declaration can change the accessibility of the virtual method. An abstract inherited property cannot be overridden in a derived class. An abstract method is implicitly a virtual method.

A. 1, 3
B. 1, 2, 5
C. 2, 3, 4
D. 4 only
Answer» C. 2, 3, 4
80.

Which of the following correctly describes the contents of the filename AssemblyInfo.cs?

A. It contains method-level attributes.
B. It contains class-level attributes.
C. It contains assembly-level attributes.
D. It contains structure-level attributes.
E. It contains namespace-level attributes.
Answer» D. It contains structure-level attributes.
81.

It possible to create a custom attribute that can be applied only to specific programming element(s) like ____ .

A. Classes
B. Methods
C. Classes and Methods
D. Classes, Methods and Member-Variables
Answer» D. Classes, Methods and Member-Variables
82.

Which of the following statements are correct? Instance members of a class can be accessed only through an object of that class. A class can contain only instance data and instance member function. All objects created from a class will occupy equal number of bytes in memory. A class can contain Friend functions. A class is a blueprint or a template according to which objects are created.

A. 1, 3, 5
B. 2, 4
C. 3, 5
D. 2, 4, 5
E. None of these
Answer» B. 2, 4
83.

Which of the following is NOT an Assignment operator in C#.NET?

A. =
B. /=
C. *=
D. +=
E. %=
Answer» B. /=
84.

Which of the following will be the correct output for the C#.NET program given below? namespace IndiabixConsoleApplication { class Sample { int i; Single j; public void SetData(int i, Single j) { i = i; j = j; } public void Display() { Console.WriteLine(i + " " + j); } } class MyProgram { static void Main(string[ ] args) { Sample s1 = new Sample(); s1.SetData(10, 5.4f); s1.Display(); } } }

A. 0 0
B. 10 5.4
C. 10 5.400000
D. 10 5
E. None of the above
Answer» B. 10 5.4
85.

Which of the following statements are correct about the C#.NET code snippet given below? sample c; c = new sample(); It will create an object called sample. It will create a nameless object of the type sample. It will create an object of the type sample on the stack. It will create a reference c on the stack and an object of the type sample on the heap. It will create an object of the type sample either on the heap or on the stack depending on the size of the object.

A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5
E. None of these
Answer» C. 3, 5
86.

Which of the following statements is correct about classes and objects in C#.NET?

A. Class is a value type.
B. Since objects are typically big in size, they are created on the stack.
C. Objects of smaller size are created on the heap.
D. Smaller objects that get created on the stack can be given names.
E. Objects are always nameless.
Answer» F.
87.

Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + " " + 13 % 2);

A. 6.5 1
B. 6.5 0
C. 6 0
D. 6 1
E. 6.5 6.5
Answer» E. 6.5 6.5
88.

Which of the following are Logical operators in C#.NET? &amp;&amp; || ! Xor %

A. 1, 2, 3
B. 1, 3, 4
C. 2, 4, 5
D. 3, 4, 5
E. None of these
Answer» B. 1, 3, 4
89.

Which of the following are the correct ways to increment the value of variable a by 1? ++a++; a += 1; a ++ 1; a = a +1; a = +1;

A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5
E. None of these
Answer» C. 3, 5
90.

Which of the following statements are correct about data types? If the integer literal exceeds the range of byte, a compilation error will occur. We cannot implicitly convert non-literal numeric types of larger storage size to byte. Byte cannot be implicitly converted to float. A char can be implicitly converted to only int data type. We can cast the integral character codes.

A. 1, 3, 5
B. 2, 4
C. 3, 5
D. 1, 2, 5
Answer» E.
91.

Which of the following is NOT a Bitwise operator in C#.NET?

A. &
B. |
C. <<
D. ^
E. ~
Answer» D. ^
92.

Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface? The ArrayList class contains an inner class that implements the IEnumerator interface. An ArrayList Collection cannot be accessed simultaneously by different threads. The inner class of ArrayList can access ArrayList class's members. To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it. Enumerator's of ArrayList Collection can manipulate the array.

A. 1 and 2 only
B. 1 and 3 and 4 only
C. 2 and 5 only
D. All of the above
E. None of the above
Answer» C. 2 and 5 only
93.

For the code snippet given below, which of the following statements are valid? public class MyContainer&lt;T&gt; where T: IComparabte { // Insert code here } Class MyContainer requires that it's type argument must implement IComparabte interface. Type argument of class MyContainer must be IComparabte. Compiler will report an error for this block of code. This requirement on type argument is called as constraint.

A. 1 and 2 Only
B. 1, 2 and 3 Only
C. 1 and 4 Only
D. All of the above
E. None of the above
Answer» D. All of the above
94.

For the code snippet given below, which of the following statements are valid? public class MyContainer&lt;T&gt; where T: class, IComparable { //Insert code here } Class MyContainer requires that it's type argument must implement IComparable interface. Compiler will report an error for this block of code. There are multiple constraints on type argument to MyContainer class. Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.

A. 1 and 2 Only
B. 3 and 4 Only
C. 2 and 3 Only
D. All of the above
E. None of the above
Answer» C. 2 and 3 Only
95.

Which of the following statements is valid about advantages of generics?

A. Generics shift the burden of type safety to the programmer rather than compiler.
B. Generics require use of explicit type casting.
C. Generics provide type safety without the overhead of multiple implementations.
D. Generics eliminate the possibility of run-time errors.
E. None of the above.
Answer» D. Generics eliminate the possibility of run-time errors.
96.

Which of the following statements is valid about generic procedures in C#.NET?

A. All procedures in a Generic class are generic.
B. Only those procedures labeled as Generic are generic.
C. Generic procedures can take at the most one generic parameter.
D. Generic procedures must take at least one type parameter.
E. None of the above.
Answer» E. None of the above.
97.

In which of the following areas are delegates commonly used? Remoting Serialization File Input/Output Multithreading Event handling

A. 1 and 2 only
B. 1 and 5 only
C. 1, 2 and 3 only
D. 4 and 5 only
E. All of the above
Answer» E. All of the above
98.

Which of the following statements are correct about delegates? Delegates are not type-safe. Delegate is a user-defined type. Only one method can be bound with one delegate object. Delegates can be used to implement callback notification. Delegates permit execution of a method on a secondary thread in an asynchronous manner.

A. 1 and 2 only
B. 1, 2 and 3 only
C. 2, 4 and 5 only
D. 4 and 5 only
E. All of the above
Answer» D. 4 and 5 only
99.

Which of the following statements are correct about the delegate declaration given below? delegate void del(int i); On declaring the delegate a class called del will get created. The signature of del need not be same as the signature of the method that we intend to call using it. The del class will be derived from the MulticastDelegate class. The method that can be called using del should not be a static method. The del class will contain a one-argument constructor and an lnvoke() method.

A. 1, 2 and 3 only
B. 1, 3 and 5 only
C. 2 and 4 only
D. 4 only
E. All of the above
Answer» C. 2 and 4 only
100.

Which of the following statements are correct? String is a value type. String literals can contain any character literal including escape sequences. The equality operators are defined to compare the values of string objects as well as references. Attempting to access a character that is outside the bounds of the string results in an IndexOutOfRangeException. The contents of a string object can be changed after the object is created.

A. 1, 3
B. 3, 5
C. 2, 4
D. 1, 2, 4
Answer» D. 1, 2, 4