21. Which of the following jump statements transfers program control to a labeled statement?

  • break
  • continue
  • goto
  • return

22. What is the output of the following code snippet?

int i = 0;

while(i < 5)

{

if(i == 2)

continue;

Console.Write(i + " ");

i++;

}

  • 0 1 2 3 4 5
  • 0 1 3 4
  • 0 1 2 3 4
  • 0 1 4 5

23. What is the value of x after the following code is executed?

int x = 5;

x *= 2 + 3;

  • 10
  • 25
  • 30
  • 35

24. What is the result of the following code?

arduino

Copy code

int i = 1;

do

{

Console.Write("{0} ", i);

i++;

} while (i <= 5);

  • 2 3 4 5
  • 2 3 4 5 6
  • 1 2 3 4
  • 1 2 3 4 5

25. Which of the following is not a jump statement in C#?

  • break
  • continue
  • return
  • print

Array & String - Practice Quiz

26.What is an array in C#?

  • A named function used to perform a specific operation
  • A fixed value that cannot be changed during program execution
  • A collection of values of the same data type, stored in contiguous memory locations
  • A named memory location used to store a value that can be modified during program execution

27. What are the types of arrays in C#?

  • Single-dimensional, multi-dimensional, and jagged arrays
  • Single-dimensional, multi-dimensional, and nested arrays
  • Linear arrays, rectangular arrays, and jagged arrays
  • Regular arrays, irregular arrays, and jagged arrays

28. What is a string in C#?

  • A named function used to perform a specific operation
  • A fixed value that cannot be changed during program execution
  • A collection of values of the same data type, stored in contiguous memory locations
  • A sequence of characters, stored as an array of characters in contiguous memory locations

29. What is the difference between the Length and Count properties of a string?

  • They are synonyms and can be used interchangeably
  • Length is used for strings with one-dimensional arrays, and Count is used for strings with multi-dimensional arrays
  • Length is used for strings, and Count is used for arrays
  • Length is a property of the string class, and Count is a method of the collection class

30. What is a string method in C#?

  • A named function used to perform a specific operation on a string
  • A pre-defined function provided by the .NET framework to manipulate strings
  • A custom function created by a developer to manipulate strings
  • A programming construct used to define a sequence of characters in a string

Leave a Reply