Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C# M-1

Total questions: 116

Worksheet time: 2hrs 56mins

Name
Class
Date
1.

CLR stands for ___________________

a)

Common Language Runtime

b)

Common Linguistic Runtime

c)

Common Language Realtime

d)

None of the above

2.

When a program is compiled the code is converted into _________

a)

Executable code

b)

Objective code

c)

MSIL

d)

None

3.

Is MSIL is platform dependant?

a)

Yes

b)

No

4.

Identify the incorrect signature of Main() method.

a)

void Main()

b)

static void Main(string[] str)

c)

static void Main(String[] args)

d)

public static void Main()

5.

Which of the following are the values types?

a)

Int32

b)

bool

c)

double

d)

class

6.

Which of the following are the reference types?

a)

Class

b)

Delegate

c)

String

d)

All of the above

7.

Struct in C# is _________________

a)

Value type

b)

Reference Type

c)

Pointer

d)

None of the above

8.

Predict the output of the below code.

class Demo

{

static void Main()

{

Console.Write("Welcome to C#")

}

}

a)

Would display, "Welcome to C#"

b)

Compilation error at line number 3

c)

Compilation error at line number 5

d)

Code will compile but won't display anything

9.

Who will identify the compilation errors in a aprogram?

a)

CLR

b)

Compiler

c)

JIT

d)

None of the above

10.

Is Microsoft .NET a Open source framework

a)

No

b)

Yes

11.

Which method converts the string representation of an integral to its Int32 representation?

a)

parseInt()

b)

ToInt()

c)

parse()

d)

None of the above

12.

Which of the following is not a property of a string?

a)

Strings are mutable

b)

Strings are reference types

c)

Strings have a default value null

d)

Strings are immutable

13.

In a visual studio project, can we have more than one entry point?

a)

Yes

b)

No

14.

Which of the following are the reference types?

a)

int

b)

Delegate

c)

String

d)

Array

15.

Is enum a reference type?

a)

Yes

b)

No

16.

According to CTS all the types in .NET are derived from _________

a)

System.Object

b)

System.ValueType

c)

System.Console

d)

None of the above

17.

The Read() method of Console class does __________

a)

Reads collection of characters from the standard input stream

b)

Reads a character from the standard input stream

c)

Reads a character from the standard input stream till encounters a new like escape sequences

d)

None of the above

18.

The Read() method of Console class

a)

returns collection of characters as string

b)

returns a character

c)

returns the ASCII value of a read character

d)

None of the above

19.

What is the output of the below statement.

int a=10;

int b=20;

Console.WriteLine("Sum is:"+a+b);

a)

Sum is:30

b)

Sum is:10+20

c)

Sum is:1020

d)

Gives compilation error

20.

Does the .NET framework provide language compilers?

a)

Yes

b)

No

22.

Which of the following converts a type to a single Unicode character, where possible in C#?

23.

SOAP stands for

a)

simple object access program

b)

simple object account program

c)

simple object application program

d)

simple object access protocol

24.

CLR is the .NET equivalent of _________.

a)

A. Java Virtual Machine

b)

B. Common Language Runtime

c)

C. Common Type System

d)

D. Common Language Specification

25.

The CLR is physically represented by an assembly named _______.

a)

A. mscoree.dll

b)

B. mcoree.dll

c)

C. msoree.dll

d)

D. mscor.dll

26.

The ____ language allows more than one method in a single class.

a)

A. C#

b)

B. J#

c)

C. C++

d)

D. C

27.

In C#, a subroutine is called a ________.

a)

A. Function

b)

B. Metadata

c)

C. Method

d)

D. Managed code

28.

All C# applications begin execution by calling the _____ method.

a)

A. Class()

b)

B. Main()

c)

C. Submain()

d)

D. Namespace

29.

A _______ is an identifier that denotes a storage location.

a)

A. Constant

b)

B. Reference type

c)

C. Variable

d)

D. Object

30.

_________ are reserved, and cannot be used as identifiers.

a)

A. Keywords

b)

B. literal

c)

C. variables

d)

D. Identifiers

31.

The character pair ?: is a________________available in C#.

a)

A. Unary operator

b)

B. Ternary operator

c)

C. Decision operator

d)

D. Functional operator

32.

In C#, all binary operators are ______.

a)

A. Center-associative

b)

B. Right-associative

c)

C. Left-associative

d)

D. Top-associative

33.

A _____ is any valid C# variable ending with a colon.

a)

A. goto

b)

B. Label

c)

C. Logical

d)

D. Bitwise

34.

C# has _______ operator, useful for making two way decisions.

a)

A. Looping

b)

B. Functional

c)

C. Exponential

d)

D. Conditional

35.

________causes the loop to continue with the next iteration after skipping any statements in between.

a)

A. Loop

b)

B. Exit

c)

C. Break

d)

D. Continue

36.

Arrays in C# are ______ objects.

a)

A. Reference

b)

B. Logical

c)

C. Value

d)

D. Arithmetic

37.

______ parameters are used to pass results back to the calling method.

a)

A. Input

b)

B. Reference

c)

C. Value

d)

D. Output

38.

C# does not support _____ constructors.

a)

A. parameterized

b)

B. parameter-less

c)

C. Class

d)

D. Method

39.

A structure in C# provides a unique way of packing together data of ______ types.

a)

A. Different

b)

B. Same

c)

C. Invoking

d)

D. Calling

40.

The C# provides special methods known as _____ methods to provide access to data members.

a)

A. Loop

b)

B. Functions

c)

C. Methods

d)

D. Accessor

41.

Inheritance is ______ in nature.

a)

A. Commutative

b)

B. Associative

c)

C. Transitive

d)

D. Iterative

42.

In C#, having unreachable code is always an _____.

a)

A. Method

b)

B. Function

c)

C. Error

d)

D. Iterative

43.

C# treats the multiple catch statements like cases in a _____________ statement.

A. If

B. Switch

C. For

D. While

a)

A. If

b)

B. Switch

c)

C. For

d)

D. While

44.

C# supports a technique known as________, which allows a method to specify explicitly the name of the interface it is implementing.

a)

A. Method Implementaion

b)

B. Implicit Interface Implementation

c)

C. Explicit Interface Implementation

d)

D. Iterative Interface Implementation

45.

The reason that C# does not support multiple inheritances is because of ______.

a)

A. Method collision

b)

B. Name collision

c)

C. Function collision

d)

D. Interface collision

46.
  1. 2. C# runs on the ___.

a)
  1. .NET Framework

b)
  1. Java Virtual Machine

c)
  1. Both A. and B.

d)
  1. None of the above

47.
  1. 5. What does the CLR in C# do?

a)
  1. Manages the execution of Webpages programs

b)
  1. Manages the parsing of the various types

c)
  1. Manages the execution of .NET programs

d)
  1. All of the above

48.
  1. 9. What is 'Console' in C#?

a)
  1. Class

b)
  1. Object

c)
  1. Method

d)
  1. Structure

49.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int a, b, c, x;

  4. a = 80;

  5. b = 15;

  6. c = 2;

  7. x = a - b / (3 c) ( a + c);

  8. Console.WriteLine(x);

  9. Console.ReadLine();

  10. }

a)

78

b)

-84

c)

80

d)

98

50.

What will be the output of the following C# code?

m = 5; int y;

y = m++;

y = ++m;

a)

y = 5, m = 6; y = 7, m = 7

b)

y = 6, m = 6; y = 7, m = 6

c)

y = 5, m = 6 ; y = 5, m = 5

d)

y = 5, m = 6; y = 7, m = 8

51.

What will be the output of the following C# code?

  1. bool a = true;

  2. bool b = false;

  3. a |= b;

  4. Console.WriteLine(a);

  5. Console.ReadLine();

a)

0

b)

1

c)

True

d)

False

52.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int a = 5, b = 10;

  4. if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b))) {

  5. Console.WriteLine(a + "\n" + b);

  6. }

  7. else

  8. Console.WriteLine(" C# ");

  9. }

a)

6 11

b)

6 16

c)

6 12

d)

6 10

53.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. char ch = 'p';

  4. switch (ch)

  5. {

  6. case 'p':

  7. Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));

  8. break;

  9. default:

  10. Console.WriteLine("default");

  11. break;

  12. }

  13. Console.WriteLine("main");

  14. }

a)

coco main

b)

coco 112

c)

coco 112 main

d)

compile time error

54.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int i = 0;

  4. if (i == 0)

  5. {

  6. goto label;

  7. }

  8. label: Console.WriteLine("HI...");

  9. Console.ReadLine();

  10. }

a)

Hi…infinite times

b)

Code runs prints nothing

c)

Hi Hi

d)

Hi…

55.

Which of the following is used to define the member of a class externally?

a)

:

b)

::

c)

#

d)

none of the mentioned

56.

What does the following C# code imply?

cs abc; abc = new cs();

a)

Object creation on class csharp

b)

Create an object of type csharp on heap or on stack depending on the size of object

c)

create a reference c on csharp and an object of type csharp on heap

d)

create an object of type csharp on stack

57.

Which reference modifier is used to define a reference variable?

a)

&

b)

ref

c)

#

d)

$

58.

Which of these can be overloaded?

a)

Constructors

b)

Methods

c)

Both Constructors & Methods

d)

None of the mentioned

59.

Select the output for the following set of code:

1. static void Main(string[] args)

2. {

3. int y = 5;

4. int x;

5. int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + 10;

6. Console.WriteLine(x);

7. Console.WriteLine(y);

8. Console.ReadLine();

9. }

a)

5, 8

b)

8, 5

c)

11, 8

d)

10, 4

60.

Give the Correct Output for the given set of programming code is :

1. class Program

2. {

3. static void Main(string[] args)

4. {

5. int i ;

6. for ( i = 0; i < 5; i++)

7. {

8. int j = 0;

9. j += i;

10. Console. WriteLine(j);

11. }

12. Console. WriteLine(i);

13. Console. ReadLine();

14. }

15. }

a)

0, 1, 2, 3, 4, 5, 6

b)

0, 1, 2, 3, 4

c)

0, 1, 2, 3, 4, 5

d)

0, 1, 2, 3

61.

Select the output for the following set of Code :

1. static void Main(string[] args)

2. {

3. int a = -1;

4. int b = -1;

5. if (Convert.ToBoolean (++a = ++b))

6. Console.WriteLine("a");

7. else

8. Console.WriteLine("b");

9. Console.ReadLine();

10. }

a)

a

b)

b

c)

Compile time error

d)

Code execute successfully with no output

62.

1. static void Main(string[] args)

2. {

3. int x;

4. x = Convert.ToInt32(Console.ReadLine());

5. int c = 1;

6. while (c <= x)

7. {

8. if (c % 2 == 0)

9. {

10. Console.WriteLine("Execute While " + c + "\t" + "time");

11. }

12. c++;

13. }

14. Console.ReadLine();

15. }

for x = 8 the program output will be,

a)

Execute while 1 time Execute while 3 time Execute while 5 time Execute while 7 time

b)

Execute while 2 time Execute while 4 time Execute while 6 time Execute while 8 time

c)

Execute while 1 time Execute while 2 time Execute while 3 time Execute while 4 time Execute while 5 time Execute while 6 time Execute while 7 time

d)

Execute while 2 time Execute while 3 time Execute while 4 time Execute while 5 time

63.

Select the output for the following set of code :

1. static void Main(string[] args)

2. {

3. int i = 0;

4. int j = 0;

5. for (i = 0; i < 4; i++)

6. {

7. for (j = 0; j < 3; j++)

8. {

9. if (i > 1)

10. continue;

11. Console.WriteLine("Hi \n");

12. }

13. }

14. Console.ReadLine();

15. }

a)

Prints hi 4 times

b)

Prints hi 3 times

c)

Prints hi 6 times

d)

Prints hi infinite times

64.

Select the output for the following set of code :

1. class sample

2. {

3. public int i;

4. public int j;

5. public void fun(int i, int j)

6. {

7. this.i = i;

8. this.j = j;

9. }

10. }

11. class Program

12. {

13. static void Main(string[] args)

14. {

15. sample s = new sample();

16. s.i = 1;

17. s.j = 2;

18. s.fun(s.i, s.j);

19. Console.WriteLine(s.i + " " + s.j);

20. Console.ReadLine();

21. }

22. }

a)

Error while calling s.fun() due to inaccessible level

b)

Error as ‘this’ reference would not be able to call ‘i’ and ‘j’

c)

1 2

d)

Runs successfully but prints nothing

65.

Select the correct output for the following code

1. class z

2. {

3. public int X;

4. public int Y;

5. public const int c1 = 5;

6. public const int c2 = c1 * 25;

7. public void set(int a, int b)

8. {

9. X = a;

10. Y = b;

11. }

12.

13. }

14. class Program

15. {

16. static void Main(string[] args)

17. {

18. z s = new z();

19. s.set(10, 20);

20. Console.WriteLine(s.X + " " + s.Y);

21. Console.WriteLine(z.c1 + " " + z.c2);

22. Console.ReadLine();

23. }

24. }

a)

10 20 5 25

b)

20 10 25 5

c)

10 20 5 125

d)

20 10 125 5

66.

The output of code is ?

1. class test

2. {

3. public void print()

4. {

5. Console.WriteLine("Csharp:");

6. }

7. }

8. class Program

9. {

10. static void Main(string[] args)

11. {

12. test t;

13. t.print();

14. Console.ReadLine();

15. }

16. }

a)

Code runs successfully prints nothing

b)

Code runs and prints “Csharp”

c)

None of the mentioned

d)

Syntax error as t is unassigned variable which is never used

67.

What is output for the following set of code?

1. static void Main(string[] args)

2. {

3. string s1 = "Hello";

4. string s2 = "hello";

5. if (s1 == s2)

6. Console.WriteLine("Equal");

7. else

8. Console.WriteLine("Unequal");

9. if (s1.Equals (s2))

10. Console.WriteLine("Equal");

11. else

12. Console.WriteLine("Unequal");

13. Console.ReadLine();

14. }

a)

Equal Unequal

b)

compiler error

c)

Equal Equal

d)

Unequal Unequal

68.

Which of the following statements are correct?

a)

String is value type

b)

String literals can contain any character literal including escape sequences

c)

The equality operators are defined to compare values of string objects as well as references

d)

All of the mentioned

69.

What is output of the following set of code?

1. static void Main(string[] args)

2. {

3. Program p = new Program();

4. p.display(2, 3, 8);

5. int []a = { 2, 56, 78, 66 };

6. Console.WriteLine("example of array");

7. Console.WriteLine("elements added are");

8. p.display(a);

9. Console.ReadLine();

10. }

11. public void display(params int[] b)

12. {

13. foreach (int i in b)

14. {

15. Console.WriteLine("ARRAY IS HAVING:{0}", i);

16. }

17. }

a)

Compile time error

b)

Run time error

c)

Code runs successfully but prints nothing

d)

Code runs successfully and prints given on console

70.

Choose selective differences between an array in c# and array in other programming languages.

a)

Declaring array in C# the square bracket([]) comes after the type but not after identifier

b)

It is necessary to declare size of an array with its type

c)

No difference between declaration of array in c# as well as as in other programming languages

d)

All of the mentioned

71.

What will be the correct output for the given code snippet?

1. class recursion

2. {

3. int fact(int n)

4. {

5. int result;

6. if (n == 1)

7. return 1;

8. result = fact(n - 1) * n;

9. return result;

10. }

11. }

12. class Program

13. {

14. public static void main(String args[])

15. {

16. recursion obj = new recursion() ;

17. Console.WriteLine(obj.fact(4));

18. }

19. }

a)

24

b)

30

c)

120

d)

144

72.

What will be the correct output the for the given code snippet?

1. class maths

2. {

3. int fact(int n)

4. {

5. int result;

6. if (n == 1)

7. return 1;

8. result = fact(n - 1) * n;

9. return result;

10. }

11. }

12. class Output

13. {

14. static void main(String args[])

15. {

16. maths obj = new maths() ;

17. Console.WriteLine(obj.fact(1));

18. }

19. }

a)

2

b)

10

c)

1

d)

0

73.

What will be the correct output for the given code snippet?

1. class maths

2. {

3. int fact(int n)

4. {

5. int result;

6. if (n == 1)

7. return 1;

8. result = fact(n - 1) n;

9. return result;

10. }

11. }

12. class Output 1

3. {

14. static void main(String args[])

15. {

16. maths obj = new maths() ;

17. Console.WriteLine(obj.fact(4)obj.fact(2));

18. }

19. }

a)

64

b)

60

c)

120

d)

48

74.

What are the main types of inheritance in C#?

a)

Single Inheritance, Multiple Inheritance (through interfaces), Multilevel Inheritance, Hierarchical Inheritance

b)

Circular Inheritance

c)

Abstract Inheritance

d)

Static Inheritance

75.

Explain single inheritance and its advantages.

a)

Single inheritance is only applicable in functional programming languages.

b)

Single inheritance can lead to code duplication in large projects.

c)

Multiple inheritance allows for more complex relationships between classes.

d)

Advantages of single inheritance include simplicity in the class hierarchy, easier maintenance, reduced complexity, and improved code reusability.

76.

What is multiple inheritance and how is it achieved in C#?

a)

Multiple inheritance is achieved through abstract classes in C#.

b)

C# does not support multiple inheritance at all.

c)

A class can inherit from multiple base classes directly in C#.

d)

In C#, multiple inheritance is achieved through interfaces, allowing a class to implement multiple interfaces.

77.

Define method overriding in the context of C# inheritance.

a)

Method overriding allows a base class to change its own methods.

b)

Method overriding is used to create new methods in the base class.

c)

Method overriding prevents derived classes from accessing base class methods.

d)

Method overriding in C# allows a derived class to provide a specific implementation of a method that is already defined in its base class.

78.

How does the 'virtual' keyword affect method overriding?

a)

The 'virtual' keyword prevents method overriding in derived classes.

b)

The 'virtual' keyword has no effect on method overriding.

c)

The 'virtual' keyword enables polymorphism and allows derived classes to override base class methods.

d)

The 'virtual' keyword is used to declare static methods only.

79.

What is an abstract class and how is it used in C#?

a)

An abstract class in C# can be instantiated directly.

b)

An abstract class in C# is used to create concrete classes only.

c)

An abstract class in C# is a class that cannot be instantiated and is used to define a base class with abstract methods for derived classes to implement.

d)

An abstract class in C# cannot contain any methods or properties.

80.

Can an abstract class have concrete methods?

a)

An abstract class can only have static methods.

b)

Yes, all methods in an abstract class must be abstract.

c)

Yes, an abstract class can have concrete methods.

d)

No, an abstract class cannot have any methods.

81.

What is the purpose of an interface in C#?

a)

To provide a way to inherit implementation details.

b)

To create a new data type with properties.

c)

To define a contract for classes to implement.

d)

To manage memory allocation for classes.

82.

How do interfaces differ from abstract classes?

a)

Interfaces allow multiple inheritance and only contain method signatures; abstract classes can provide implementation and cannot be instantiated.

b)

Abstract classes allow multiple inheritance and only contain method signatures.

c)

Interfaces cannot be inherited by multiple classes.

d)

Interfaces can be instantiated and contain method implementations.

83.

What is polymorphism and how does it relate to inheritance?

a)

Polymorphism is a type of inheritance that only applies to abstract classes.

b)

Polymorphism allows different classes to be treated as instances of the same class through inheritance, enabling method overriding and dynamic behavior.

c)

Polymorphism is unrelated to inheritance and focuses solely on data encapsulation.

d)

Polymorphism restricts classes to a single method implementation.

84.

Explain the concept of compile-time polymorphism in C#.

a)

Compile-time polymorphism cannot be implemented in C# using interfaces.

b)

Compile-time polymorphism is a runtime feature in C#.

c)

Compile-time polymorphism is only achieved through inheritance.

d)

Compile-time polymorphism in C# is achieved through method overloading and operator overloading.

85.

What is runtime polymorphism and how is it achieved in C#?

a)

Runtime polymorphism is achieved in C# through method overriding using virtual and override keywords.

b)

Runtime polymorphism is achieved by using static methods in C#.

c)

Runtime polymorphism is achieved through method overloading using the new keyword.

d)

Runtime polymorphism is implemented using interfaces and abstract classes only.

86.

How can you implement an interface in a class?

a)

Use the 'implements' keyword in the class declaration and define all interface methods.

b)

Use the 'override' keyword to implement interface methods.

c)

Define interface methods without implementing them.

d)

Use the 'extends' keyword in the class declaration.

87.

What happens if a class does not implement all members of an interface?

a)

The class will automatically implement the missing members.

b)

The class will not compile.

c)

The class will run but produce runtime errors.

d)

The class will inherit the members from a parent class.

88.

Can a class inherit from multiple interfaces?

a)

No, a class can only inherit from one interface.

b)

No, interfaces cannot be inherited by classes.

c)

Yes, but only if the interfaces are related.

d)

Yes, a class can inherit from multiple interfaces.

89.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int a, b, c, x;

  4. a = 80;

  5. b = 15;

  6. c = 2;

  7. x = a - b / (3 c) ( a + c);

  8. Console.WriteLine(x);

  9. Console.ReadLine();

  10. }

a)

78

b)

-84

c)

80

d)

98

90.

What will be the output of the following C# code?

m = 5; int y;

y = m++;

y = ++m;

a)

y = 5, m = 6; y = 7, m = 7

b)

y = 6, m = 6; y = 7, m = 6

c)

y = 5, m = 6 ; y = 5, m = 5

d)

y = 5, m = 6; y = 7, m = 8

91.

What will be the output of the following C# code?

  1. bool a = true;

  2. bool b = false;

  3. a |= b;

  4. Console.WriteLine(a);

  5. Console.ReadLine();

a)

0

b)

1

c)

True

d)

False

92.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int a = 5, b = 10;

  4. if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b))) {

  5. Console.WriteLine(a + "\n" + b);

  6. }

  7. else

  8. Console.WriteLine(" C# ");

  9. }

a)

6 11

b)

6 16

c)

6 12

d)

6 10

93.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. char ch = 'p';

  4. switch (ch)

  5. {

  6. case 'p':

  7. Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));

  8. break;

  9. default:

  10. Console.WriteLine("default");

  11. break;

  12. }

  13. Console.WriteLine("main");

  14. }

a)

coco main

b)

coco 112

c)

coco 112 main

d)

compile time error

94.

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int i = 0;

  4. if (i == 0)

  5. {

  6. goto label;

  7. }

  8. label: Console.WriteLine("HI...");

  9. Console.ReadLine();

  10. }

a)

Hi…infinite times

b)

Code runs prints nothing

c)

Hi Hi

d)

Hi…

95.

Which of the following is used to define the member of a class externally?

a)

:

b)

::

c)

#

d)

none of the mentioned

96.

What does the following C# code imply?

cs abc; abc = new cs();

a)

Object creation on class csharp

b)

Create an object of type csharp on heap or on stack depending on the size of object

c)

create a reference c on csharp and an object of type csharp on heap

d)

create an object of type csharp on stack

97.

Which reference modifier is used to define a reference variable?

a)

&

b)

ref

c)

#

d)

$

98.

Which of these can be overloaded?

a)

Constructors

b)

Methods

c)

Both Constructors & Methods

d)

None of the mentioned

99.

What is the syntax to declare a variable in C#?

a)

myVariable = int;

b)

int myVariable;

c)

var myVariable;

d)

myVariable = int;

100.

Which data type is used to store whole numbers in C#?

a)

boolean

b)

float

c)

string

d)

int

101.

What is the purpose of control structures in C#?

a)

The purpose of control structures in C# is to randomly change the output of a program.

b)

The purpose of control structures in C# is to slow down the execution of a program.

c)

The purpose of control structures in C# is to add unnecessary complexity to the code.

d)

The purpose of control structures in C# is to control the flow of execution in a program.

102.

Which control structure is used to execute a block of code repeatedly?

a)

if-else

b)

switch

c)

for loop

d)

loop

103.

What is an array in C#?

a)

A data structure that stores a variable-size sequence of elements of different types.

b)

A data structure that stores a fixed-size sequence of elements of the same type.

c)

A programming language used for web development.

d)

A function that performs a specific task in C#.

104.

How do you access elements in an array in C#?

a)

myArray[index]

b)

myArray{index}

c)

myArray(index)

d)

myArray.index

105.

What is object-oriented programming (OOP) in C#?

a)

Object-oriented programming (OOP) in C# is a programming technique used for writing efficient algorithms.

b)

Object-oriented programming (OOP) in C# is a programming language used for creating graphical user interfaces.

c)

Object-oriented programming (OOP) in C# is a programming paradigm that allows for the creation of objects that contain both data and methods.

d)

Object-oriented programming (OOP) in C# is a programming concept that focuses on procedural programming.

106.

What are the four pillars of OOP in C#?

a)

encapsulation, inheritance, polymorphism, and encapsulation

b)

encapsulation, inheritance, polymorphism, and abstraction

c)

encapsulation, inheritance, polymorphism, and encapsulation

d)

encapsulation, inheritance, polymorphism, and encapsulation

107.

What is exception handling in C#?

a)

Exception handling in C# is a way to ignore runtime errors and continue program execution.

b)

Exception handling in C# is a feature that allows the programmer to intentionally introduce errors in the program.

c)

Exception handling in C# is a technique to prevent runtime errors from occurring in a program.

d)

Exception handling in C# is a mechanism to handle runtime errors or exceptions that occur during the execution of a program.

108.

How do you handle exceptions in C#?

a)

Using try-catch blocks

b)

Using switch statements

c)

Using for loops

d)

Using if-else statements

109.
a)

a

b)

b

c)

c

d)

d

110.
a)

a

b)

b

c)

c

d)

d

111.
a)

a

b)

b

c)

c

d)

d

112.
a)

a

b)

b

c)

c

d)

d

113.
a)

a

b)

b

c)

c

d)

d

114.
a)

a

b)

b

c)

c

d)

d

115.
a)

a

b)

b

c)

c

d)

d

116.
a)

a

b)

b

c)

c

d)

d