Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q631: The 'unsafe' keyword in C# is used to declare code that works with _______.
- A: Managed code
- B: Unmanaged code
- C: Arrays
- D: Strings
View Answer
B
Q632: Which of the following can be a disadvantage of using unsafe code in C#?
- A: Easier debugging
- B: Stack overflow
- C: Automatic memory management
- D: Simplified syntax
View Answer
B
Q633: What does the 'fixed' keyword in C# prevent?
- A: Memory leaks
- B: Stack overflow
- C: The garbage collector from moving objects
- D: Syntax errors
View Answer
C
Q634: What is the purpose of the '->' operator in C#?
- A: Dereference pointers to structs
- B: Declare arrays
- C: Access array elements
- D: Access private methods
View Answer
A
Q635: How are arrays in C# similar to arrays in Java?
- A: Both use the 'new' operator for declaration
- B: Both allow fixed-size arrays
- C: Both are reference types
- D: Both require manual garbage collection
View Answer
A
Q636: What is a rectangular array in C#?
- A: An array with a fixed size for each dimension
- B: An array with irregular dimensions
- C: An array of arrays
- D: An array containing elements of different types
View Answer
A
Q637: Which of the following is true about jagged arrays in C#?
- A: They are multidimensional arrays with fixed sizes
- B: They can hold arrays of different lengths
- C: They are stored as single-dimensional arrays
- D: They cannot hold references to other arrays
View Answer
B
Q638: In C#, which type of array is declared as an array of arrays?
- A: Rectangular array
- B: Jagged array
- C: Dynamic array
- D: Multidimensional array
View Answer
B
Q639: How are enumerations used in C#?
- A: They define constant values
- B: They define functions
- C: They store user input
- D: They are used for dynamic memory allocation
View Answer
A
Q640: What is the default data type for C# enumerations?
- A: String
- B: Integer
- C: Char
- D: Long
View Answer
B