C# (C Sharp) MCQs with answers Page - 34

Here, you will find a collection of MCQ questions on C# (C Sharp). Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are correct about the C#.NET
code snippet given below?
if (age > 18 && no < 11) a = 25;
1. The condition no < 11 will be evaluated only if age > 18 evaluates to True.
2. The statement a = 25 will get executed if any one condition is True.
3. The condition no < 11 will be evaluated only if age > 18 evaluates to False.
4. The statement a = 25 will get executed if both the conditions are True.
5. && is known as a short circuiting logical operator.

  • (A) 1,3
  • (B) 2,5
  • (C) 1,4,5,
  • (D) 3,4,5

A

Admin • 833.24K Points
Coach

Q. 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

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are correct?
1. Instance members of a class can be accessed only through an object of that class.
2. A class can contain only instance data and instance member function.
3. All objects created from a class will occupy equal number of bytes in memory.
4. A class can contain Friend functions.
5. 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

A

Admin • 833.24K Points
Coach

Q. Which of the following is the correct way to create an object of the class Sample?
1. Sample s = new Sample();
2. Sample s;
3. Sample s; s = new Sample();
4. s = new Sample();

  • (A) 1,3
  • (B) 2,4
  • (C) 1,2,3
  • (D) 4,5

A

Admin • 833.24K Points
Coach

Q. Which of following statement are correct about functions?

  • (A) C# allows a function to have arguments with default values
  • (B) Redefining a method parameter in the method’s body causes an exception
  • (C) C# allows function to have arguments of private type
  • (D) Omitting the return type in method definition results into exception

A

Admin • 833.24K Points
Coach

Q. In which of the following collections is the Input/Output index-based? 1. Stack 2. Queue 3. BitArray 4. ArrayList 5. HashTable

  • (A) 1 and 2 only
  • (B) 3 and 4 only
  • (C) 5 only
  • (D) 1, 2 and 5 only

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are correct about the Stack collection?
1. It can be used for evaluation of expressions.
2. All elements in the Stack collection can be accessed using an enumerator.
3. It is used to maintain a FIFO list.
4. All elements stored in a Stack collection must be of similar type.
5. Top-most element of the Stack collection can be accessed using the Peek() method.

  • (A) 1 and 2 only
  • (B) 3 and 4 only
  • (C) 1, 2 and 5 only
  • (D) All of the above

A

Admin • 833.24K Points
Coach

Q. Which of the following statements are correct about the delegate declaration given below? delegate void del(int I);
1. On declaring the delegate a class called del will get created.
2. The signature of del need not be same as the signature of the method that we intend to call using it.
3. The del class will be derived from the MulticastDelegate class.
4. The method that can be called using del should not be a static method.
5. 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

A

Admin • 833.24K Points
Coach

Q. The following namespaces (System.Data.OleDB, System.Data.SqlClient, System.Data.Odbc, System.Data.OracleClient) include classes for different:

  • (A) Data providers
  • (B) File streams
  • (C) ADO.NET applications
  • (D) Databases

A

Admin • 833.24K Points
Coach

Q. Which of the following is a definition of a database?

  • (A) It is a collection of related information organized on a computer.
  • (B) It is single flat file.
  • (C) It is a file that can only be set up on a single PC.
  • (D) It is a group of files that can be set up only on a network.

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ