Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Chapter: 16
Q301:
The Ada assignment operator is:
A. =
B. :=
C. ==
D. =>
Correct Answer: B
Chapter: 16
Q302:
Fill in the blank: The Ada "exit" statement is used to ________.
A. Exit a loop
B. Exit a function
C. Exit a program
D. Exit a block
Correct Answer: A
Chapter: 16
Q303:
In Ada, what is used to access individual fields in a record?
A. ->
B. .
C. ::
D. #
Correct Answer: B
Chapter: 16
Q304:
What happens if an Ada "case" statement has no match for the expression?
A. Nothing happens
B. An exception is raised at compile time
C. An exception is raised at runtime
D. The program stops
Correct Answer: B
Chapter: 17
Q305:
What is the primary purpose of the return statement in a function?
A. To raise an exception
B. To exit a loop
C. To return a value
D. To define a new variable
Correct Answer: C
Chapter: 17
Q306:
In Ada, which statement is used to raise an exception?
A. raise
B. throw
C. catch
D. raise_exception
Correct Answer: A
Chapter: 17
Q307:
What must a function in Ada have at least one of?
A. Variable
B. Exception
C. Return statement
D. Parameter
Correct Answer: C
Chapter: 17
Q308:
How are exceptions declared in Ada?
A. Like procedures
B. Like variables
C. Like constants
D. Like types
Correct Answer: B
Chapter: 17
Q309:
In Ada, exception-handling code is written at the end of a ________.
A. for loop
B. block
C. procedure
D. function
Correct Answer: B
Chapter: 17
Q310:
Which part of an Ada package typically defines its public interface?
A. Package body
B. Package specification
C. Package implementation
D. Package footer
Correct Answer: B
Chapter: 17
Q311:
What is the purpose of the PUSH procedure in the STACK package?
A. Remove an item from the stack
B. Add an item to the stack
C. Clear the stack
D. Sort the stack
Correct Answer: B
Chapter: 17
Q312:
What is a "tagged type" in Ada?
A. A private type
B. A dynamic type
C. An extensible type
D. A constant
Correct Answer: C
Chapter: 17
Q313:
Which construct in Ada allows the initiation of parallel tasks?
A. Package
B. Tasking
C. Exception handling
D. Generic
Correct Answer: B
Chapter: 17
Q314:
Generics in Ada are similar to what feature in C++?
A. Macros
B. Templates
C. Functions
D. Classes
Correct Answer: B
Chapter: 17
Q315:
What is the output of the POP function in the STACK package?
A. The number of items in the stack
B. The top item in the stack
C. The maximum size of the stack
D. A sorted stack
Correct Answer: B
Chapter: 17
Q316:
In Ada, where can an exception-handling code be placed?
A. After the end statement of a block
B. Within a procedure
C. Before a package declaration
D. After a function call
Correct Answer: A
Chapter: 17
Q317:
What does the tasking mechanism in Ada enable?
A. Sequential execution
B. Concurrent execution
C. Exception handling
D. Error logging
Correct Answer: B
Chapter: 17
Q318:
Fill in the blank: The statement used to explicitly raise an exception in Ada is ________.
A. throw
B. raise
C. raise_exception
D. throw_error
Correct Answer: B
Chapter: 17
Q319:
Fill in the blank: In Ada, a tagged type is similar to a ________ in object-oriented programming.
A. class
B. function
C. constant
D. package
Correct Answer: A
Chapter: 17
Q320:
Fill in the blank: The return statement in a function allows the function to _________.
A. exit
B. return a value
C. raise an exception
D. loop over variables
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now