Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q271: In Ada, how is a discriminated record type defined for holding different data types?
- A: Using union types
- B: By using the case keyword inside a record
- C: By using arrays
- D: Using pointers
View Answer
B
Q272: In Ada, how is an access type used?
- A: It corresponds to a reference in Python
- B: It corresponds to a pointer in C++
- C: It creates a new variable
- D: It links two records
View Answer
B
Q273: What happens if the type mismatch occurs in a discriminated record in Ada?
- A: The program compiles normally
- B: An exception is raised
- C: The program crashes
- D: The program skips the operation
View Answer
B
Q274: In Ada, what is used to define an array with no specific size?
- A: The type's discriminant
- B: A generic record
- C: An unspecified range
- D: A pointer
View Answer
C
Q275: Which of the following is the correct way to assign a value to a field of a record in Ada?
- A: Record_Field := value
- B: Record.Field := value
- C: Field := value
- D: value := Record_Field
View Answer
B
Q276: What is the Ada keyword used to start an if statement block?
- A: begin
- B: then
- C: do
- D: case
View Answer
B
Q277: Which Ada feature is used to ensure type safety in a record that holds either an integer or a float?
- A: Arrays
- B: Discriminated records
- C: Access types
- D: Subtypes
View Answer
B
Q278: In Ada, how do you refer to the entire record accessed by an access value?
- A: A_Ref.all
- B: A_Ref.pointer
- C: A_Ref.value
- D: A_Ref.pointer.all
View Answer
A
Q279: In Ada, which statement starts a block for an if condition that has more than one statement to execute?
- A: then
- B: do
- C: begin
- D: case
View Answer
A
Q280: What does a case statement in Ada resemble in C?
- A: switch statement
- B: loop statement
- C: condition statement
- D: assignment statement
View Answer
A