

MCQOPTIONS
Saved Bookmarks
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.
201. |
Which of the following statements is correct about constructors? |
A. | If we provide a one-argument constructor then the compiler still provides a zero-argument constructor. |
B. | Static constructors can use optional arguments. |
C. | Overloaded constructors cannot use optional arguments. |
D. | If we do not provide a constructor, then the compiler provides a zero-argument constructor. |
Answer» E. | |
202. |
Which statement will you add in the function fun() of class B, if it is to produce the output "Welcome to IndiaBIX.com!"? namespace IndiabixConsoleApplication { class A { public void fun() { Console.Write("Welcome"); } } class B: A { public void fun() { // [*** Add statement here ***] Console.WriteLine(" to IndiaBIX.com!"); } } class MyProgram { static void Main (string[ ] args) { B b = new B(); b.fun(); } } } |
A. | <i class="csharp-code">base.fun();</i> |
B. | <i class="csharp-code">A::fun();</i> |
C. | <i class="csharp-code">fun();</i> |
D. | <i class="csharp-code">mybase.fun();</i> |
E. | <i class="csharp-code">A.fun();</i> |
Answer» B. <i class="csharp-code">A::fun();</i> | |
203. |
Which of the following will be the correct output for the C#.NET code snippet given below? String s1="Kicit"; Console.Write(s1.IndexOf('c') + " "); Console.Write(s1.Length); |
A. | 3 6 |
B. | 2 5 |
C. | 3 5 |
D. | 2 6 |
E. | 3 7 |
Answer» C. 3 5 | |
204. |
Which of the following .NET components can be used to remove unused references from the managed heap? |
A. | Common Language Infrastructure |
B. | CLR |
C. | Garbage Collector |
D. | Class Loader |
E. | CTS |
Answer» D. Class Loader | |
205. |
Which of the following assemblies can be stored in Global Assembly Cache? |
A. | Private Assemblies |
B. | Friend Assemblies |
C. | Shared Assemblies |
D. | Public Assemblies |
E. | Protected Assemblies |
Answer» D. Public Assemblies | |
206. |
Which of the following statements are correct about static functions? Static functions can access only static data. Static functions cannot call instance functions. It is necessary to initialize static data. Instance functions can call static functions and access static data. this reference is passed to static functions. |
A. | 1, 2, 4 |
B. | 2, 3, 5 |
C. | 3, 4 |
D. | 4, 5 |
E. | None of these |
Answer» B. 2, 3, 5 | |
207. |
What will be the output of the following code snippet when it is executed? int x = 1; float y = 1.1f; short z = 1; Console.WriteLine((float) x + y * z - (x += (short) y)); |
A. | 0.1 |
B. | 1.0 |
C. | 1.1 |
D. | 11 |
Answer» B. 1.0 | |
208. |
Which of the following does not store a sign? |
A. | <i class="csharp-code">Short</i> |
B. | <i class="csharp-code">Integer</i> |
C. | <i class="csharp-code">Long</i> |
D. | <i class="csharp-code">Byte</i> |
E. | <i class="csharp-code">Single</i> |
Answer» E. <i class="csharp-code">Single</i> | |
209. |
Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified? |
A. | <i class="csharp-code">float pi = 3.14F;</i> |
B. | <i class="csharp-code">#define pi 3.14F;</i> |
C. | <i class="csharp-code">const float pi = 3.14F;</i> |
D. | <i class="csharp-code">const float pi; pi = 3.14F;</i> |
E. | <i class="csharp-code">pi = 3.14F;</i> |
Answer» D. <i class="csharp-code">const float pi; pi = 3.14F;</i> | |
210. |
Which of the following statements are correct about the Bitwise & operator used in C#.NET? The & operator can be used to Invert a bit. The & operator can be used to put ON a bit. The & operator can be used to put OFF a bit. The & operator can be used to check whether a bit is ON. The & operator can be used to check whether a bit is OFF. |
A. | 1, 2, 4 |
B. | 2, 3, 5 |
C. | 3, 4 |
D. | 3, 4, 5 |
E. | None of these |
Answer» E. None of these | |
211. |
Which of the following statement correctly assigns a value 33 to a variable c? byte a = 11, b = 22, c; |
A. | <i class="csharp-code">c = (byte) (a + b);</i> |
B. | <i class="csharp-code">c = (byte) a + (byte) b;</i> |
C. | <i class="csharp-code">c = (int) a + (int) b;</i> |
D. | <i class="csharp-code">c = (int)(a + b);</i> |
E. | <i class="csharp-code">c = a + b;</i> |
Answer» B. <i class="csharp-code">c = (byte) a + (byte) b;</i> | |
212. |
Multiple inheritance is different from multiple levels of inheritance. |
A. | True |
B. | False |
Answer» B. False | |
213. |
The way a derived class member function can access base class public members, the base class member functions can access public member functions of derived class. |
A. | True |
B. | False |
Answer» C. | |
214. |
Which of the following will be the correct output for the C#.NET code snippet given below? String s1 = "ALL MEN ARE CREATED EQUAL"; String s2; s2 = s1.Substring(12, 3); Console.WriteLine(s2); |
A. | ARE |
B. | CRE |
C. | CR |
D. | REA |
E. | CREATED |
Answer» C. CR | |
215. |
Which of the following is the correct way to call the function MyFun() of the Sample class given below? class Sample { public int MyFun(int i) { Console.WriteLine("Welcome to IndiaBIX.com !" ); return 0; } } |
A. | <pre><code class="csharp">delegate void del(int i); Sample s = new Sample(); deld = new del(ref s.MyFun); d(10);</code></pre> |
B. | <pre><code class="csharp">delegate int del(int i); Sample s = new Sample(.); del = new delegate(ref MyFun); del(10);</code></pre> |
C. | <pre><code class="csharp">Sample s = new Sample(); delegate void del = new delegate(ref MyFun); del(10);</code></pre> |
D. | <pre><code class="csharp">delegate int del(int i); del d; Sample s = new Sample(); d = new del(ref s.MyFun); d(10);</code></pre> |
Answer» E. | |
216. |
Suppose on pushing a button an object is to be notified, but it is not known until runtime which object should be notified. Which of the following programming constructs should be used to implement this idea? |
A. | Attribute |
B. | Delegate |
C. | Namespace |
D. | Interface |
E. | Encapsulation |
Answer» C. Namespace | |
217. |
A HashTable t maintains a collection of names of states and capital city of each state. Which of the following is the correct way to find out whether "Kerala" state is present in this collection or not? |
A. | <i class="csharp-code">t.ContainsKey("Kerala");</i> |
B. | <i class="csharp-code">t.HasValue("Kerala");</i> |
C. | <i class="csharp-code">t.HasKey("Kerala");</i> |
D. | <i class="csharp-code">t.ContainsState("Kerala");</i> |
E. | <i class="csharp-code">t.ContainsValue("Kerala");</i> |
Answer» B. <i class="csharp-code">t.HasValue("Kerala");</i> | |
218. |
If Sample class has a Length property with get and set accessors then which of the following statements will work correctly? Sample.Length = 20; Sample m = new Sample(); m.Length = 10; Console.WriteLine(Sample.Length); Sample m = new Sample(); int len; len = m.Length; Sample m = new Sample(); m.Length = m.Length + 20; |
A. | 1, 3 |
B. | 2, 4, 5 |
C. | 4 only |
D. | 3, 5 |
Answer» C. 4 only | |
219. |
Which of the following statements is correct about an Exception? |
A. | It occurs during compilation. |
B. | It occurs during linking. |
C. | It occurs at run-time. |
D. | It occurs during Just-In-Time compilation. |
E. | It occurs during loading of the program. |
Answer» D. It occurs during Just-In-Time compilation. | |
220. |
Which of the following is the correct way to overload + operator? |
A. | <pre><code class="csharp">public sample operator + ( sample a, sample b )</code></pre> |
B. | <pre><code class="csharp">public abstract operator + ( sample a, sample b)</code></pre> |
C. | <pre><code class="csharp">public abstract sample operator + (sample a, sample b )</code></pre> |
D. | <pre><code class="csharp">public static sample operator + ( sample a, sample b )</code></pre> |
E. | All of the above |
Answer» E. All of the above | |
221. |
Which of the following is the correct way to implement the interface given below? interface IPerson { String FirstName { get; set; } } |
A. | <pre><code class="csharp">class Employee : IPerson { private String str; public String FirstName { get { return str; } set { str = value; } } }</code></pre> |
B. | <pre><code class="csharp">class Employee { private String str; public String IPerson.FirstName { get { return str; } set { str = value; } } }</code></pre> |
C. | <pre><code class="csharp">class Employee : implements IPerson { private String str; public String FirstName { get { return str; } set { str = value; } } }</code></pre> |
D. | None of the above |
Answer» B. <pre><code class="csharp">class Employee { private String str; public String IPerson.FirstName { get { return str; } set { str = value; } } }</code></pre> | |
222. |
Which of the following statements is correct about the .NET Framework? |
A. | .NET Framework uses DCOM for achieving language interoperability. |
B. | .NET Framework is built on the DCOM technology. |
C. | .NET Framework uses DCOM for making transition between managed and unmanaged code. |
D. | .NET Framework uses DCOM for creating unmanaged applications. |
E. | .NET Framework uses COM+ services while creating Distributed Applications. |
Answer» D. .NET Framework uses DCOM for creating unmanaged applications. | |
223. |
Which of the following is an 8-byte Integer? |
A. | <i class="csharp-code">Char</i> |
B. | <i class="csharp-code">Long</i> |
C. | <i class="csharp-code">Short</i> |
D. | <i class="csharp-code">Byte</i> |
E. | <i class="csharp-code">Integer</i> |
Answer» C. <i class="csharp-code">Short</i> | |
224. |
Which of the following is NOT an Arithmetic operator in C#.NET? |
A. | ** |
B. | + |
C. | / |
D. | % |
E. | * |
Answer» B. + | |
225. |
What will be the output of the C#.NET code snippet given below? int i, j = 1, k; for (i = 0; i < 5; i++) { k = j++ + ++j; Console.Write(k + " "); } |
A. | 8 4 16 12 20 |
B. | 4 8 12 16 20 |
C. | 4 8 16 32 64 |
D. | 2 4 6 8 10 |
Answer» C. 4 8 16 32 64 | |
226. |
Which of the following statements are correct? C# allows a function to have arguments with default values. C# allows a function to have variable number of arguments. Omitting the return value type in method definition results into an exception. Redefining a method parameter in the method's body causes an exception. params is used to specify the syntax for a function with variable number of arguments. |
A. | 1, 3, 5 |
B. | 3, 4, 5 |
C. | 2, 5 |
D. | 4, 5 |
E. | None of these |
Answer» D. 4, 5 | |
227. |
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) { this.i = i; this.j = j; } public void Display() { Console.WriteLine(i + " " + j); } } class MyProgram { static void Main(string[ ] args) { Sample s1 = new Sample(); s1.SetData(36, 5.4f); s1.Display(); } } } |
A. | 0 0.0 |
B. | 36 5.4 |
C. | 36 5.400000 |
D. | 36 5 |
E. | None of the above |
Answer» C. 36 5.400000 | |
228. |
Which of the following is correct about the C#.NET snippet given below? namespace IndiabixConsoleApplication { class Baseclass { public void fun() { Console.WriteLine("Hi" + " "); } public void fun(int i) { Console.Write("Hello" + " "); } } class Derived: Baseclass { public void fun() { Console.Write("Bye" + " "); } } class MyProgram { static void Main(string[ ] args) { Derived d; d = new Derived(); d.fun(); d.fun(77); } } } |
A. | The program gives the output as: Hi Hello Bye |
B. | The program gives the output as: Bye Hello |
C. | The program gives the output as: Hi Bye Hello |
D. | Error in the program |
Answer» C. The program gives the output as: Hi Bye Hello | |
229. |
Which of the following statements are correct about Inheritance in C#.NET? A derived class object contains all the base class data. Inheritance cannot suppress the base class functionality. A derived class may not be able to access all the base class data. Inheritance cannot extend the base class functionality. In inheritance chain construction of object happens from base towards derived. |
A. | 1, 2, 4 |
B. | 2, 4, 5 |
C. | 1, 3, 5 |
D. | 2, 4 |
Answer» D. 2, 4 | |
230. |
How many times can a constructor be called during lifetime of the object? |
A. | As many times as we call it. |
B. | Only once. |
C. | Depends upon a Project Setting made in Visual Studio.NET. |
D. | Any number of times before the object gets garbage collected. |
E. | Any number of times before the object is deleted. |
Answer» C. Depends upon a Project Setting made in Visual Studio.NET. | |
231. |
Which of the following statements are correct about the C#.NET code snippet given below? int[] a = {11, 3, 5, 9, 4}; The array elements are created on the stack. Refernce a is created on the stack. The array elements are created on the heap. On declaring the array a new array class is created which is derived from System.Array Class. Whether the array elements are stored in the stack or heap depends upon the size of the array. |
A. | 1, 2 |
B. | 2, 3, 4 |
C. | 2, 3, 5 |
D. | 4, 5 |
E. | None of these |
Answer» C. 2, 3, 5 | |
232. |
Which of the following are the correct ways to declare a delegate for calling the function func() defined in the sample class given below? class Sample { public int func(int i, Single j) { /* Add code here. */ } } |
A. | <i class="csharp-code">delegate d(int i, Single j);</i> |
B. | <i class="csharp-code">delegate void d(int, Single);</i> |
C. | <i class="csharp-code">delegate int d(int i, Single j);</i> |
D. | <i class="csharp-code">delegate void (int i, Single j);</i> |
E. | <i class="csharp-code">delegate int sample.func(int i, Single j);</i> |
Answer» D. <i class="csharp-code">delegate void (int i, Single j);</i> | |
233. |
Which of the following will be the correct output for the C#.NET code snippet given below? String s1 = "Five Star"; String s2 = "FIVE STAR"; int c; c = s1.CompareTo(s2); Console.WriteLine(c); |
A. | 0 |
B. | 1 |
C. | 2 |
D. | -1 |
E. | -2 |
Answer» E. -2 | |
234. |
Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr? |
A. | <i class="csharp-code">arr.Count</i> |
B. | <i class="csharp-code">arr.GrowSize</i> |
C. | <i class="csharp-code">arr.MaxIndex</i> |
D. | <i class="csharp-code">arr.Capacity</i> |
E. | <i class="csharp-code">arr.UpperBound</i> |
Answer» B. <i class="csharp-code">arr.GrowSize</i> | |
235. |
Which of the followings are NOT a .NET namespace? System.Web System.Process System.Data System.Drawing2D System.Drawing3D |
A. | 1, 3 |
B. | 2, 4, 5 |
C. | 3, 5 |
D. | 1, 2, 3 |
Answer» C. 3, 5 | |
236. |
Which of the following is correct ways of applying an attribute? |
A. | <pre><code class="csharp">[WebService (Name = "IndiaBIX", Description = "BIX WebService")] class AuthenticationService: WebService { /* .... */}</code></pre> |
B. | <pre><code class="csharp"><WebService ( Name : "IndiaBIX", Description : "BIX WebService" )> class AuthenticationService: inherits WebService { /* .... */}</code></pre> |
C. | <pre><code class="csharp"><WebService ( Name = "IndiaBIX", Description = "BIX WebService" )> class AuthenticationService: extends WebService { /* .... */}</code></pre> |
D. | <pre><code class="csharp">[WebService ( Name := "IndiaBIX", Description := "BIX WebService")] class AuthenticationService: inherits WebService { /* .... */}</code></pre> |
Answer» B. <pre><code class="csharp"><WebService ( Name : "IndiaBIX", Description : "BIX WebService" )> class AuthenticationService: inherits WebService { /* .... */}</code></pre> | |
237. |
If a Student class has an indexed property which is used to store or retrieve values to/from an array of 5 integers, then which of the following are the correct ways to use this indexed property? Student[3] = 34; Student s = new Student(); s[3] = 34; Student s = new Student(); Console.WriteLine(s[3]); Console.WriteLine(Student[3]); Student.this s = new Student.this(); s[3] = 34; |
A. | 1, 2 |
B. | 2, 3 |
C. | 3, 4 |
D. | 3, 5 |
Answer» C. 3, 4 | |
238. |
Which of the following modifier is used when a virtual method is redefined by a derived class? |
A. | <i class="csharp-code">overloads</i> |
B. | <i class="csharp-code">override</i> |
C. | <i class="csharp-code">overridable</i> |
D. | <i class="csharp-code">virtual</i> |
E. | <i class="csharp-code">base</i> |
Answer» C. <i class="csharp-code">overridable</i> | |
239. |
Which of the following are NOT true about .NET Framework? It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely. It provides a code-execution environment that minimizes software deployment and versioning conflicts. It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party. It provides different programming models for Windows-based applications and Web-based applications. It provides an event driven programming model for building Windows Device Drivers. |
A. | 1, 2 |
B. | 2, 4 |
C. | 4, 5 |
D. | 1, 2, 4 |
Answer» D. 1, 2, 4 | |
240. |
What will be the output of the C#.NET code snippet given below? int val; for (val = -5; val <= 5; val++) { switch (val) { case 0: Console.Write ("India"); break; } if (val > 0) Console.Write ("B"); else if (val < 0) Console.Write ("X"); } |
A. | XXXXXIndia |
B. | IndiaBBBBB |
C. | XXXXXIndiaBBBBB |
D. | BBBBBIndiaXXXXX |
E. | Zero |
Answer» D. BBBBBIndiaXXXXX | |
241. |
Which of the following statements are correct about functions and subroutines used in C#.NET? A function cannot be called from a subroutine. The ref keyword causes arguments to be passed by reference. While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control passes back to the calling method. A subroutine cannot be called from a function. Functions and subroutines can be called recursively. |
A. | 1, 2, 4 |
B. | 2, 3, 5 |
C. | 3, 5 |
D. | 4, 5 |
E. | None of these |
Answer» C. 3, 5 | |
242. |
Which of the following CANNOT occur multiple number of times in a program? |
A. | namespace |
B. | Entrypoint |
C. | Class |
D. | Function |
E. | Subroutine |
Answer» C. Class | |
243. |
Which of the following is the correct way to create an object of the class Sample? Sample s = new Sample(); Sample s; Sample s; s = new Sample(); s = new Sample(); |
A. | 1, 3 |
B. | 2, 4 |
C. | 1, 2, 3 |
D. | 1, 4 |
E. | None of these |
Answer» B. 2, 4 | |
244. |
Which of the following statements should be added to the subroutine fun( ) if the C#.NET code snippet given below is to output 9 13? class BaseClass { protected int i = 13; } class Derived: BaseClass { int i = 9; public void fun() { // [*** Add statement here ***] } } |
A. | <i class="csharp-code">Console.WriteLine(base.i + " " + i);</i> |
B. | <i class="csharp-code">Console.WriteLine(i + " " + base.i);</i> |
C. | <i class="csharp-code">Console.WriteLine(mybase.i + " " + i);</i> |
D. | <i class="csharp-code">Console.WriteLine(i + " " + mybase.i);</i> |
E. | <i class="csharp-code">Console.WriteLine(i + " " + this.i);</i> |
Answer» C. <i class="csharp-code">Console.WriteLine(mybase.i + " " + i);</i> | |
245. |
Which of the following statements are correct about the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class index { protected int count; public index() { count = 0; } } class index1: index { public void increment() { count = count +1; } } class MyProgram { static void Main(string[] args) { index1 i = new index1(); i.increment(); } } } count should be declared as public if it is to become available in the inheritance chain. count should be declared as protected if it is to become available in the inheritance chain. While constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class. Constructor of index class does not get inherited in index1 class. count should be declared as Friend if it is to become available in the inheritance chain. |
A. | 1, 2, 5 |
B. | 2, 3, 4 |
C. | 3, 5 |
D. | 4, 5 |
E. | None of these |
Answer» C. 3, 5 | |
246. |
Which of the following statements are correct about a delegate? Inheritance is a prerequisite for using delegates. Delegates are type-safe. Delegates provide wrappers for function pointers. The declaration of a delegate must match the signature of the method that we intend to call using it. Functions called using delegates are always late-bound. |
A. | 1 and 2 only |
B. | 1, 2 and 3 only |
C. | 2, 3 and 4 only |
D. | All of the above |
E. | None of the above |
Answer» D. All of the above | |
247. |
Which of the following is the necessary condition for implementing delegates? |
A. | Class declaration |
B. | Inheritance |
C. | Run-time Polymorphism |
D. | Exceptions |
E. | Compile-time Polymorphism |
Answer» B. Inheritance | |
248. |
Which of the following statements are valid about generics in .NET Framework? Generics is a language feature. We can create a generic class, however, we cannot create a generic interface in C#.NET. Generics delegates are not allowed in C#.NET. Generics are useful in collection classes in .NET framework. None of the above |
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 | |
249. |
Which of the following statements are correct about the structure declaration given below? struct Book { private String name; protected int totalpages; public Single price; public void Showdata() { Console.WriteLine(name + " " + totalpages + " " + price); } Book() { name = " "; totalpages = 0; price = 0.0f; } } Book b = new Book(); We cannot declare the access modifier of totalpages as protected. We cannot declare the access modifier of name as private. We cannot define a zero-argument constructor inside a structure. We cannot declare the access modifier of price as public. We can define a Showdata() method inside a structure. |
A. | 1, 2 |
B. | 1, 3, 5 |
C. | 2, 4 |
D. | 3, 4, 5 |
Answer» C. 2, 4 | |
250. |
Attributes can be applied to Method Class Assembly Namespace Enum |
A. | 1 and 2 only |
B. | 1, 2 and 3 |
C. | 4 and 5 only |
D. | All of the above |
E. | None of the above |
Answer» C. 4 and 5 only | |