C# Question
C# Question
a) A FileStream is used to read and write bytes, while a StreamReader is used to read text. b) A
FileStream is used to read and write characters, while a StreamReader is used to read and write lines of
text. c) A FileStream is used for low-level file access, while a StreamReader is used for high-level file
access. d) A FileStream is used for binary data, while a StreamReader is used for text data.
9 What is the difference between the [Link]() and [Link]() methods? a) The
[Link]() method reads the entire contents of a file into a single string, while the
[Link]() method reads the entire contents of a file into an array of strings. b) The
[Link]() method is used for text files, while the [Link]() method is used for binary
files. c) The [Link]() method is faster than the [Link]() method. d) The
[Link]() method is more memory-efficient than the [Link]() method.
a) Use a try-catch block. b) Use a finally block. c) Use a using statement. d) All of the above
Answers:
b) File
b) [Link]()
b) [Link]()
a) OpenFile() or b) [Link]()
a) ReadLine() or d) ReadAllLines()
a) WriteLine() or c) WriteAllText()
a) A FileStream is used to read and write bytes, while a StreamReader is used to read text.
a) The [Link]() method reads the entire contents of a file into a single string, while the
[Link]() method reads the entire contents of a file into an array of strings.
A. Oracle
B. Microsoft
C. GNU project
D. Google
Answer: B) Microsoft
Explanation:
A. .NET Framework
B. Java Virtual Machine
C. Both A. and B.
D. None of the above
Explanation:
A. Web apps
B. Desktop apps
C. Mobiles apps
D. All of the above
Explanation:
C# programming language is used to develop the web apps, desktop apps, mobile apps, games
and much more.
A. Yes
B. No
Answer: A) Yes
Explanation:
A. Yes
B. No
Answer: B) No
Explanation:
Answer: C) .cs
Explanation:
A. Anders Hejlsberg
B. Douglas Crockford
C. Rasmus Lerdorf
D. Brendan Eich
Explanation:
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, C# is a type safe programming language, the C# type safe code can only access the memory
location that it has permission to execute. Therefore, it improves a security of the program.
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, C# is a structured programming language that means we can break the program into parts
using functions. So, it is easy to understand and modify.
Explanation:
Explanation:
.NET CLR is equivalent to JVM (Java Virtual Machine).
Explanation:
Explanation:
Explanation:
A. True
B. False
Answer: A) True
Explanation:
16. Which symbols are used to mark the beginning and end of a code block?
A. Square brackets []
B. Curly braces {}
C. Round brackets ()
D. Double-quotes ""
Explanation:
Explanation:
A. Yes
B. No
Answer: A) Yes
Explanation:
Explanation:
A. // and //
B. \\ and //
C. <!-- and -->
D. /* and */
Answer: D) /* and */
Explanation:
Explanation:
type variableName = value; - It defines the type and assigns the value
type variableName; - It defines the type only
A. text
B. txt
C. string
D. str
Answer: C) string
Explanation:
A. define
B. fixed
C. constant
D. const
Answer: D) const
Explanation:
Explanation:
A. long
B. int
C. float
D. complex
Answer: D) complex
Explanation:
26. Which is the correct order for implicit type conversion to convert a smaller to a larger
type in C#?
Answer: A) char -> int -> long -> float -> double
Explanation:
The implicit type conversion is done in the following order: char -> int -> long -> float ->
double.
27. Which is the correct order for explicit type conversion to convert a larger to a smaller
type in C#?
A. double -> float -> long -> int -> char -> bool
B. double -> float -> long -> int -> char
C. float -> double -> long -> int -> char
D. float -> double -> long -> int -> char -> bool
Answer: B) double -> float -> long -> int -> char
Explanation:
The explicit type conversion is done in the following order: double -> float -> long -> int -> char.
28. Which is the correct C# statement to convert a float value to int explicitly?
Explanation:
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
bool x = true;
[Link]([Link](x));
}
}
}
A. True
B. true
C. False
D. false
Answer: A) True
Explanation:
In the above C# code, we are using [Link]() method which converts bool to
string. Thus, the output will be "True".
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
double x = 10.25;
[Link](Convert.ToInt32(x));
}
}
}
A. 10.30
B. 10.25
C. 10
D. Error
Answer: C) 10
Explanation:
In the above C# code, we are using Convert.ToInt32() method which converts double to
int. Thus, the output will be "10".
3) C# Input/Output MCQs
31. What is 'Console' in C#?
A. Class
B. Object
C. Method
D. Structure
Answer: A) Class
Explanation:
In C#, the Console class is used to represent the standard input, output, and error streams for
the console applications.
32. What will be the output of the following C# code, if the input is 123?
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
[Link]("Enter a number:");
int num = [Link]();
[Link]("Given number is: " + num);
}
}
}
Answer: D) Error
Explanation:
In C#, [Link]() is used to read the string and here we are trying to input an
integer value. Thus, the output will be an error.
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
[Link]("Enter a number:");
int num = Convert.ToInt32([Link]());
[Link]("Given number is: " + num);
}
}
}
Explanation:
In C#, [Link]() is used to read the string and here the input is 123 and
converting it into an integer. This, there will not be an error.
34. Which is/are the correct method(s) to input a float value in C#?
A. Parse([Link]())
B. ToSingle([Link]())
C. ToFloat([Link]());
D. Both A and B
E. Both A and C
Explanation:
In C#, the following methods can be used to input a float value:
[Link]([Link]());
[Link]([Link]());
Answer: B) Write() writes the data on the console without printing a newline while
[Link]() writes the data on the console along with printing a newline
Explanation:
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
int a = 10, b = 20;
[Link]("{0},{0}", a, b);
}
}
}
A. 10,10
B. 10,20
C. 20,20
D. Error
Answer: A) 10,10
Explanation:
In the above code, there are two variables a and b, but while printing the values of a and b, we
are using the same placeholder {0}, that will print the value of the first variable. Thus, the
output is 10,10.
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
int a = 10, b = 20;
[Link]("{0}+{1}", a, b);
}
}
}
A. 20
B. 30
C. 10+20
D. 10+10
Answer: C) 10+20
Explanation:
using System;
class Program {
static void Main(string[] args) {
int i = 2;
int j = 10 / 4;
if (i == j) {
[Link]("True");
} else {
[Link]("False");
}
}
}
A. True
B. False
C. Error
D. None
Answer: A) True
Explanation:
The statement int j = 10/4; The value of j will be 2 because of implicit type casting.
Thus, the output will be "True".
using System;
class Program {
static void Main(string[] args) {
[Link](true ^ true);
}
}
A. True
B. False
C. Error
D. None
Answer: B) False
Explanation:
Here, we are using the Logical exclusive OR operator ^ (XOR). It returns true when one operand
evaluates to true and another operand evaluates to false. In the above code, both of the operands
are true. Thus, the output will be False.
using System;
class Program {
static void Main(string[] args) {
[Link](true && false);
}
}
A. True
B. False
C. Error
D. None
Answer: B) False
Explanation:
Here, we are using the Conditional logical AND operator (&&). It returns true of both of the
operands evaluate to true. In the above code, the operands are true, false. Thus, the output will be
"False".
Discuss this Question
A. do; {
B. statement(s);
C. } while (test_condition);
D.
E. do
F. {
G. statement(s);
H. } while (test_condition)
I.
J. do(test_condition) {
K. statement(s);
L. }while;
M.
N. do {
O. statement(s);
P. } while (test_condition);
Q.
Answer: D)
do {
statement(s);
} while (test_condition);
Explanation:
do {
statement(s);
} while (test_condition);
Answer: A) Yes
Explanation:
Yes, C# supports foreach loop. The foreach loop is used to iterate over the elements of the
collection. The collection may be an array or a list.
Example:
using System;
class Program {
static void Main(string[] args) {
// an array
int[] arr = new int[] {10, 20, 30, 40, 50};
Answer: B)
Explanation:
using System;
class Program {
static void Main(string[] args) {
int i = 100;
do {
[Link](i + " ");
++i;
} while (i <= 50);
}
}
A. Error
B. 100 101 102 ... Infinite
C. 101
D. 100
Answer: D) 100
Explanation:
The do-while loop is an exit control loop where the condition is checked after executing the loop
body. In the above code, the condition is false still loop body will be executed first. Thus, the
output will be 100.
using System;
class Program {
public static void Main() {
int i = 10;
[Link](i++);
}
}
A. 10
B. 11
C. 12
D. Error
Answer: A) 10
Explanation:
The statement i++ is a post-increment operation, and it increases the value of i after evaluating
the [Link]() statement. Thus, 10 will be printed.
Answer: A) for(;;)
Explanation:
for(;;)
47. Can we obtain the array index using foreach loop in C#?
A. Yes
B. No
Answer: B) No
Explanation:
No, we cannot obtain the array index using foreach loop because it does not keep track of the
index, it only iterates forward over the array in single steps.
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, C# supports the goto statement. The goto statement transfers the control of the program
to the specified label and the label is the valid identifier and placed just before the statement
from where the control is transferred.
Example:
using System;
class Program {
public static void Main() {
[Link]("In the main...");
int i = 1;
okay:
[Link](i + " ");
if (++i <= 10) {
goto okay;
}
}
}
/*
Output:
In the main...
1 2 3 4 5 6 7 8 9 10
*/
Explanation:
The C# throw statement is used to throw an exception manually during the execution of the
program.
A. break
B. continue
C. Both A and B
D. None of the above
Answer: A) break
Explanation:
The C# break keyword breaks the execution of the loop and sends the program’s control to the
next statement written after the loop.
5) C# Strings MCQs
51. What is String in C# meant for?
A. A variable
B. A Class
C. An Array
D. An object
Answer: D) An object
Explanation:
A. Yes
B. No
Answer: A) Yes
Explanation:
Two strings can be compared by using the == Operator.
A. String
B. [Link]
C. [Link]
D. [Link]
Answer: D) [Link]
Explanation:
In C#, [Link] is a base class for all String related methods, properties, constructors,
and operators.
54. Which String class operator is used to determine whether two specified strings have
different values?
A. !=
B. !
C. ~
D. ~
Answer: A) !=
Explanation:
In C#, the inequality operator (!=) can be used to determine whether two specified strings have
different values.
A. Equals()
B. Compare()
C. Both A and B
D. None of these
Explanation:
The Equals() and Compare() methods can also be used to compare two strings in C#.
A. Upper()
B. ToUpper()
C. Upr()
D. ToUpr()
Answer: B) ToUpper()
Explanation:
The ToUpper() method is used to convert the given string into the uppercase.
Example:
using System;
class Program {
public static void Main() {
string str = "includehelp";
[Link]([Link]());
}
}
A. Property
B. Method
C. Constructor
D. Both A and B
Answer: A) Property
Explanation:
The [Link] is property of [Link] class that is used to get the number of
characters in the current String object.
using System;
class Program {
static void Main(string[] args) {
String s1 = "Hello";
String s2 = "IncludeHelp";
String s3 = s1;
[Link]([Link](s3) + " " + [Link](s1));
}
}
A. Error
B. True True
C. True False
D. True 1
Answer: D) True 1
Explanation:
The Equals() method returns a bool value. We assigned s1 to s3. Thus, the
statement [Link](s3) will returns "True". And, the CompareTo() method returns an
int value (Less than 0, o, or greater than 0). The statement [Link](s1) will returns 1
because this instance (s2) follows s1.
using System;
class Program {
static void Main(string[] args) {
String str = "Hello";
[Link]([Link]);
}
}
A. 5
B. 6
C. 7
D. 4
Answer: A) 5
Explanation:
The [Link] returns the length of the string. Thus, the output will be 5.
using System;
class Program {
static void Main(string[] args) {
String str = "Hello";
[Link]([Link]('h'));
}
}
A. 0
B. 1
C. -1
D. Error
Answer: C) -1
Explanation:
The IndexOf() method returns the index of a given characters, and it returns -1 if the given
character is not found in the string. Here, we are trying to get the index of 'h' which is not present
in the string. Thus, the output will be -1.
6) C# Arrays MCQs
61. To declare an array, define the variable type with ___.
A. Square brackets []
B. Curly brackets {}
C. Round brackets ()
D. None of the above
Explanation:
To declare an array, define the variable type with square brackets [].
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
string[] mobiles = { "iPhone", "Samsung", "Vivo"};
[Link](mobiles);
}
}
}
Answer: D) [Link][]
Explanation:
In the above code, the statement [Link](mobiles); will print the type of
the variable that is [Link][].
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
string[] mobiles = {"iPhone", "Samsung", "Vivo"};
[Link](mobiles[-1]);
}
}
}
A. None
B. Warning
C. Exception
D. [Link][]
Answer: C) Exception
Explanation:
The array index starts from 0 in C#, in the above code – we are trying to get the element with
index -1. Thus, there will be an exception "[Link]: Index was
outside the bounds of the array."
Explanation:
In the above given C# statement, the variable 'x' is a reference to an object of a '[Link]'
class.
65. Which array property is used to get the total number of elements in C#?
A. Len
B. Length
C. Elements
D. MaxLen
Answer: B) Length
Explanation:
The Length property is used to get the total number of elements in C#.
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
string[] mobiles = {"iPhone", "Samsung", "Vivo"};
[Link](mobiles[0] + mobiles[2]);
}
}
}
A. iPhoneVivo
B. iPhone+Vivo
C. Exception
D. iPhone Vivo
Answer: A) iPhoneVivo
Explanation:
In the above code, the statement mobiles[0]+mobiles[2] will concatenate the 0th and 2nd
elements that are "iPhone" and "Vivo". Thus, the output will be "iPhoneVivo".
67. Which array method is used to sort an array alphabetically or in an ascending order in
C#?
A. sort()
B. sorting()
C. Sort()
D. Sorting()
Answer: C) Sort()
Explanation:
The Sort() method is used to sort an array alphabetically or in an ascending order in C#.
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
string[] mobiles = {"iPhone", "Samsung", "Vivo"};
[Link](mobiles[0] + mobiles[2]);
}
}
}
A. iPhone
B. Vivo
C. iPhoneVivo
D. Runtime Error
Answer: C) iPhoneVivo
using System;
namespace MyApplication {
class Program {
static void Main(string[] args) {
int[,] ARR = {{1,2},{3,4}};
[Link]([Link](0)+","+[Link](1));
}
}
}
A. 4,4
B. 2,2
C. Compilation Error
D. Runtime Error
Answer: B) 2,2
Explanation:
The above code will print the length of the of the first and second rows of the above two-
dimensional array.
70. Which of the correct syntax to declare an array with 2 rows and 3 columns in C#?
Explanation:
The correct way to declare an array with 2 rows and 3 columns in C# is:
7) C# OOP MCQs
71. Which keyword is used to define a class in C#?
A. Class
B. class
C. [Link]
D. [Link]
Answer: B) class
Explanation:
Syntax:
class class_name
{
// Class Definition
}
72. Which is the correct way to declare an object of the class in C#?
Explanation:
using System;
namespace MyApplication {
class Mobiles {
string brand = "Apple";
// Output: Apple
Explanation:
The dot (.) symbol (or dot operator) is used to access variables/fields in a class in C#.
Syntax:
Class_Name.Variable_Name/Field_Name;
A. Yes
B. No
Answer: B) No
Explanation:
No, overriding of a function is not possible in the same class in C#. As per the explanation
on MSDN – The override modifier is required to extend or modify the abstract or virtual
implementation of an inherited method, property, indexer, or event.
A. Static Constructor
B. Private Constructor
C. Body Constructor
D. Parameterized Constructor
Static constructor
Private constructor
Copy constructor
Default constructor
Parameterized constructor
A. 2
B. 3
C. 4
D. 5
Answer: C) 4
Explanation:
public
private
protected
internal
Explanation:
In C#, there are 4 types of access modifiers they are public, private, protected, and internal. And
these access modifiers are used to control the visibility of class members (the security level of
each individual class and class member).
Explanation:
In C#, the internal access modifier is used for types and type members. The internal types or
members (those are defined by the using of internal keyword/ access modifier) are accessible
only within files in the same assembly.
79. The protected access modifier defines a member that can be accessible within ___.
Explanation:
In C#, the protected access modifier defines a member that can be accessible within its class and
by derived class instances.
Answer: B) No
Explanation:
81. Which C# concept has the capability of an object to take number of different forms and
hence display behaviour as accordingly?
A. Polymorphism
B. Encapsulation
C. Abstraction
D. None of the above
Answer: A) Polymorphism
Explanation:
In C#, the concept has the capability of an object to take number of different forms and hence
display behaviour as accordingly known as "Polymorphism".
using System;
namespace MyApplication {
public class Class1 {
public static int x = 10;
}
public class Class2: Class1 {
public static int x = 20;
static void Main(string[] args) {
[Link](x + ", " + Class1.x);
}
}
}
A. 20, 20
B. 10, 10
C. 20, 10
D. Exception
Answer: C) 20, 10
Explanation:
In the above code, we are printing the values of x which is the member
of Class2 and Class1.x which is the member of Class1. Thus, the output will be "20, 10".
83. What is the C# keyword which is used to change data and behaviour of a base class by
replacing a member of the base class with a new derived member?
A. overrides
B. protected
C. base
D. new
Answer: D) new
Explanation:
The C# keyword new is used to change data and behaviour of a base class by replacing a
member of the base class with a new derived member.
A. interface
B. Interface
C. implement
D. Implement
Answer: A) interface
Explanation:
In C#, an interface can be declared using the interface keyword. An interface can contain
declarations of methods, properties, indexers, and events.
A. virtual
B. sealed
C. private
D. public
Answer: A) virtual
Explanation:
In C#, by default, the default interface methods are virtual unless the sealed or private modifier is
used.
86. In C#, the objects created using new operator are stored in ___.
A. Cache Memory
B. Stack Memory
C. Heap Memory
D. None of the above
Explanation:
In C#, the objects created using new operator are stored in Heap Memory.
A. Methods
B. Properties
C. Events
D. Structures
Answer: D) Structures
Explanation:
A. private
B. public
C. protected
D. All of the above
Answer: B) public
Explanation:
In C#, the interface members are always public, because the purpose of an interface is to
enable other types to access a class or struct. No other access modifiers can be applied to
interface members.
89. Which type of class does not have its own objects but acts as a base class for its subclass
in C#?
A. Abstract Class
B. Static Class
C. Sealed Class
D. Protected Class
In C#, the Abstract Class does not have its own objects but acts as a base class for its subclass.
90. Which modifier is used to while redefining an abstract method by a derived class in C#?
A. Overloads
B. New
C. Overrides
D. Virtual
Answer: C) Overrides
Explanation:
In C#, the Overrides modifier is used to while redefining an abstract method by a derived
class.
A. Yes
B. No
Answer: A) Yes
Explanation:
Explanation:
93. C# pointer can only be declared to hold the memory address of ___.
Explanation:
C# pointer can only be declared to hold the memory address of value types and arrays. Unlike
reference types, pointer types are not tracked by the default garbage collection mechanism.
94. How many catch blocks can be used with a single try block in C#?
A. One
B. Two
C. Many
D. None of the above
Answer: C) Many
Explanation:
In C#, there can be multiple (many) catch blocks with a single try block.
95. Is the use of return statement necessary in every function in C#?
A. Yes
B. No
Answer: A) Yes
Explanation:
96. Which access specifier should be used for Main() method in C#?
A. private
B. public
C. protected
D. internal
Answer: B) public
Explanation:
The C# Main() method should be defined as public because it is called by runtime. By default
Main() method is private.
A. True
B. False
Answer: A) True
Explanation:
98. Which is the C# class from which data type UInt is derived?
A. System.Int16
B. System.Int32
C. System.UInt16
D. System.UInt32
Answer: D) System.UInt32
Explanation:
A. using System;
B. using system;
C. using Namespace;
D. namespace MyApplication
Explanation:
using System;
100. In C#, structures are used for ___ objects such as mobiles, cars, etc.
A. Lightweight
B. Darkweight
C. Extra
D. Compress
Answer: A) Lightweight
Explanation:
In C#, structures are used for lightweight objects such as mobiles, cars, etc.
1. Which namespace is fundamental for basic
C# operations?
a) using CSharp;
b) using [Link];
c) using System;
d) using Base;
Answer:
c) using System;
Explanation:
The System namespace contains fundamental classes and base classes that
define commonly used value and reference data types, events and event
handlers, interfaces, attributes, and processing exceptions.
Answer:
c) Writes to the console with a new line
Explanation:
Answer:
b) new
Explanation:
Answer:
c) double
Explanation:
The double data type is used to store floating-point numbers (numbers with
decimal points).
Answer:
c) The member belongs to the type rather than any specific instance
Explanation:
Answer:
b) To serve as the entry point for the application
Explanation:
The Main method is the primary entry point for a C# console application.
Answer:
c) transient
Explanation:
transient is not a valid access modifier in C#. It's used in Java for other
purposes.
8. What is encapsulation?
a) Breaking the code into small functions
b) Wrapping up data members and methods into a single unit
c) Inheriting properties of one class into another
d) Implementing multiple interfaces
Answer:
b) Wrapping up data members and methods into a single unit
Explanation:
Answer:
d) :
Explanation:
Explanation:
Checked exceptions are handled using try-catch blocks. These are the
exceptions that are checked at compile time.
Answer:
c) loop
Explanation:
Answer:
b) as
Explanation:
The as operator is used for type casting in C#. If the conversion is not
possible, it returns null.
13. Which of the following is the correct way
to comment out multiple lines in C#?
a) // ...
b) /* ... */
c) -- ... --
d)
Answer:
b) /* ... */
Explanation:
Answer:
c) const
Explanation:
Answer:
a) char
Explanation:
Answer:
a) void
Explanation:
In C#, the void keyword indicates that a method does not return a value.
Answer:
d) They can declare methods without implementations.
Explanation:
Answer:
d) internal
Explanation:
Answer:
d) Derived constructor
Explanation:
Answer:
c) Checks for nullability and returns the non-null value
Explanation:
Answer:
a) Placing a value type inside an object
Explanation:
Boxing is the process of converting a value type to the type object or any
interface type implemented by this value type.
Explanation:
Answer:
d) HashSet
Explanation:
Answer:
c) int[] x;
Explanation:
Answer:
d) A framework for querying data in a consistent manner
Explanation:
Answer:
d) string str = [Link];
Explanation:
Answer:
c) Executes regardless of whether an exception is thrown or caught
Explanation:
Answer:
a) const
Explanation:
Explanation:
In C#, the Length property of the string class is used to get the number of
characters in a string.
Answer:
a) Object
Explanation:
The Object class is the base class for all classes in C#.
Answer:
d) secured
Explanation:
secured is not a valid access modifier in C#. The valid access modifiers
are public, private, protected, internal, and a few combinations thereof.
32. Which of the following types is a
reference type?
a) int
b) char
c) bool
d) string
Answer:
d) string
Explanation:
Answer:
a) Checks type compatibility
Explanation:
Answer:
c) sealed
Explanation:
Answer:
c) delegate() { }
Explanation:
Answer:
a) int? x;
Explanation:
Answer:
c) LinkList
Explanation:
Answer:
d) Dispose()
Explanation:
Answer:
a) catch
Explanation:
In C#, the try-catch block is used for exception handling, where the catch
block catches and handles exceptions.
Answer:
b) It checks for type compatibility and returns null if the conversion is not possible
Explanation:
Answer:
c) int
Explanation:
In C#, the int data type is a 32-bit signed integer that can range from -
2,147,483,648 to 2,147,483,647.
Answer:
c) abstract
Explanation:
Answer:
b) Virtual method
Explanation:
In C#, only methods declared with the virtual keyword can be overridden in
a derived class.
Answer:
b) false
Explanation:
In C#, the default value for a bool (boolean) data type is false.
Answer:
d) HashSet
Explanation:
The HashSet collection in C# ensures that all elements are unique. It does not
allow duplicate values.
Explanation:
The typeof operator is used to obtain the Type object for a type. However, to
check an object's type at runtime, the is operator is more commonly used.
Answer:
c) Delegates are type-safe.
Explanation:
Answer:
a) Overloading
Explanation:
Method overloading allows a class to have multiple methods with the same
name but with different parameters.
Answer:
c) The method can be overridden in the derived class.
Explanation:
Answer:
a) int[] array = new int[5];
Explanation:
In C#, arrays are declared by specifying the type of the elements followed by
square brackets. They are then instantiated using the new keyword followed
by the type and the size of the array.
Sure, here are some C# database programming interview questions in multiple-choice format:
Question 1:
(a) int
(b) double
(c) string
(d) varchar
Question 2:
Question 3:
Question 4:
Question 5:
(a) [Link] is a low-level API for accessing databases, while Entity Framework is a higher-level API that
provides more abstraction.
(b) [Link] is a data access technology for .NET applications, while Entity Framework is an object-
relational mapper (ORM) that simplifies data access.
(c) [Link] is a component of the .NET Framework, while Entity Framework is a third-party library.
Question 6:
Question 7:
Question 8:
Question 9:
Question 10: