Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Chapter: 15
Q261:
In Ada, what is the range of indexes for arrays defined as type Int_Buffer is array(1..10) of Integer;?
A. 0..10
B. 1..10
C. 1..20
D. 0..20
Correct Answer: B
Chapter: 15
Q262:
Which operator in Ada is used to access individual fields of a record?
A. . (dot operator)
B. -> (arrow operator)
C. : (colon operator)
D. ; (semicolon)
Correct Answer: A
Chapter: 15
Q263:
What type of data structure does Ada use to ensure type safety in place of C's union?
A. Arrays
B. Records
C. Discriminated records
D. Pointers
Correct Answer: C
Chapter: 15
Q264:
What is the assignment operator used in Ada?
A. =
B. :=
C. ->
D. :
Correct Answer: B
Chapter: 15
Q265:
In Ada, the index of an array can be of what type?
A. Integer only
B. Any discrete type
C. String only
D. Float only
Correct Answer: B
Chapter: 15
Q266:
How does Ada handle array index bounds?
A. Indexes always start from 0
B. Indexes can be defined by the programmer
C. Indexes start from 1 and can't be changed
D. Array size is fixed
Correct Answer: B
Chapter: 15
Q267:
What is the main feature of discriminated records in Ada?
A. They are unsafe
B. They have dynamic sizing
C. They use discriminants to track data type
D. They are similar to arrays
Correct Answer: C
Chapter: 15
Q268:
Which of the following can Ada arrays use as indexes?
A. Integers only
B. Positive numbers only
C. Any discrete type
D. Strings only
Correct Answer: C
Chapter: 15
Q269:
What does the Ada if statement require after each condition?
A. End if
B. End case
C. End switch
D. End loop
Correct Answer: A
Chapter: 15
Q270:
What is the purpose of the elsif keyword in Ada?
A. To define a new variable
B. To specify an additional condition in an if statement
C. To create a loop
D. To close an if statement
Correct Answer: B
Chapter: 15
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
Correct Answer: B
Chapter: 15
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
Correct Answer: B
Chapter: 15
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
Correct Answer: B
Chapter: 15
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
Correct Answer: C
Chapter: 15
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
Correct Answer: B
Chapter: 15
Q276:
What is the Ada keyword used to start an if statement block?
A. begin
B. then
C. do
D. case
Correct Answer: B
Chapter: 15
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
Correct Answer: B
Chapter: 15
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
Correct Answer: A
Chapter: 15
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
Correct Answer: A
Chapter: 16
Q280:
What does a case statement in Ada resemble in C?
A. switch statement
B. loop statement
C. condition statement
D. assignment statement
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now