C Sharp Programming

C# Basics MCQ

1. What is C#? a) A database management system b) A web development framework c) A programming language developed by Microsoft d) An operating system Click to View Answer and Explanation Answer: c) A programming language developed by Microsoft Explanation: C# is a modern, object-oriented programming language developed by Microsoft, widely used for a variety […]

C# Basics MCQ Read More »

C# File Handling MCQ

1. Which namespace is commonly used for file handling in C#? a) System.IO b) System.File c) System.Data d) System.Text Click to View Answer and Explanation Answer: a) System.IO Explanation: The System.IO namespace contains types for handling files and data streams, making it the primary namespace used for file handling in C#. 2. How do you

C# File Handling MCQ Read More »

C# Enum MCQ

1. What is an enum in C#? a) A method that returns several values b) A user-defined data type that consists of integral constants c) A special type of class for storing collections d) A data structure similar to an array Click to View Answer and Explanation Answer: b) A user-defined data type that consists

C# Enum MCQ Read More »

C# Inheritance MCQ

1. What is inheritance in C#? a) The process of creating new classes from existing ones b) Copying the same method into multiple classes c) Using the same variables in different classes d) Connecting classes through interfaces Click to View Answer and Explanation Answer: a) The process of creating new classes from existing ones Explanation:

C# Inheritance MCQ Read More »

C# OOP MCQ

1. What is encapsulation in C#? a) Breaking a program into multiple parts b) Hiding the internal state of an object and requiring all interaction to be performed through an object's methods c) The ability of a class to extend the functionality of another class d) A class that can be used to create objects

C# OOP MCQ Read More »

C# Methods MCQ

1. How do you define a method in C#? a) dataType methodName(parameters) { /* code */ } b) method dataType methodName(parameters) { /* code */ } c) dataType methodName = (parameters) { /* code */ } d) function dataType methodName(parameters) { /* code */ } Click to View Answer and Explanation Answer: a) dataType methodName(parameters)

C# Methods MCQ Read More »

C# For Loop MCQ

1. What is the basic syntax of a for loop in C#? a) for (initialization; condition; iteration) { /* code */ } b) for (condition; initialization; iteration) { /* code */ } c) for (initialization; iteration; condition) { /* code */ } d) for where (initialization; condition; iteration) { /* code */ } Click to

C# For Loop MCQ Read More »

C# Switch MCQ

1. Which of the following is the correct syntax for a switch statement in C#? a) switch(variable) { case value: /* code */ } b) switch variable { case value: /* code */ } c) switch(variable) { when value: /* code */ } d) switch(variable) { if value: /* code */ } Click to View

C# Switch MCQ Read More »

C# Arrays MCQ

1. How do you declare an array of integers in C#? a) int[] myArray; b) array<int> myArray; c) int myArray[]; d) int array[] myArray; Click to View Answer and Explanation Answer: a) int[] myArray; Explanation: In C#, arrays are declared with the type followed by square brackets, as in int[]. 2. What will be the

C# Arrays MCQ Read More »

C# Strings MCQ

1. How do you concatenate strings in C#? a) Using the '+' operator b) Using the '&' operator c) Using the concat() method d) Using the append() method Click to View Answer and Explanation Answer: a) Using the '+' operator Explanation: In C#, strings are commonly concatenated using the '+' operator. 2. What method is

C# Strings MCQ Read More »

Scroll to Top