Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q691: How does the 'as' operator differ from casting in C#?
  • A: 'as' generates an exception if the cast fails
  • B: 'as' returns null if the cast is not valid
  • C: 'as' performs a deep copy of the object
  • D: 'as' can only be used with value types
View Answer
B

Q692: What does the 'new' keyword do in C# when used with reference types?
  • A: It creates an object on the stack
  • B: It creates an object on the heap
  • C: It creates a new method
  • D: It initializes a struct
View Answer
B

Q693: What is boxing in C#?
  • A: Converting a reference type to a value type
  • B: Converting a value type to a reference type
  • C: Converting a method to a class
  • D: Converting a struct to an interface
View Answer
B

Q694: Which of the following is true about interfaces in C#?
  • A: They can have fields
  • B: They can have method implementations
  • C: They can be implemented by multiple classes
  • D: They cannot have constructors
View Answer
C

Q695: What is the primary use of delegates in C#?
  • A: To define static methods
  • B: To pass methods as arguments
  • C: To handle exceptions
  • D: To declare event handlers
View Answer
B

Q696: Which keyword is used to define a delegate in C#?
  • A: delegate
  • B: method
  • C: function
  • D: handler
View Answer
A

Q697: In C#, what does the 'new' method modifier do in method hiding?
  • A: It allows the method to be overridden
  • B: It hides a method from the base class
  • C: It marks the method as static
  • D: It ensures the method cannot be called
View Answer
B

Q698: Fill in the blank: In C#, a method can only have _______ return value.
  • A: one
  • B: two
  • C: multiple
  • D: no
View Answer
A

Q699: What will happen if a class does not use the 'new' keyword when hiding a base class method?
  • A: The base class method will be called
  • B: The compiler will throw an error
  • C: The hidden method will still be called
  • D: The method will be ignored
View Answer
A

Q700: What does PHP stand for?
  • A: Personal Home Page
  • B: PHP: Hypertext Preprocessor
  • C: Programming Hypertext Protocol
  • D: Preprocessor Hypertext Page
View Answer
B

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now