Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Quiz Question 1 (5 points) Which of the following features must a language conta

ID: 3853187 • Letter: Q

Question

Quiz

Question 1 (5 points)

Which of the following features must a language contain to support the development of abstract data types?

Question 1 options:

Concurrency

Lambda expressions

Information hiding

Inheritance

Save

Question 2 (5 points)

Which of the following is not an encapsulation mechanism?

Question 2 options:

A Java package

A C++ namespace

A Java instance variable

An Ada package

Save

Question 3 (5 points)

Information hiding is intended to hide which of the following features of a data type?

Question 3 options:

Return types of method signatures

The representation of the data type

The name of the data type

Method signatures defining a data type's operation

Save

Question 4 (5 points)

In most object-based languages, the reserved word private is provided to support which of the following?

Question 4 options:

Encapsulation

Inheritance

Information hiding

Polymorphism

Save

Question 5 (5 points)

Which of the following language features does not provide support for parameterized abstract data types?

Question 5 options:

Java generic classes

C++ templates

C function pointer parameters

Ada generic packages

Save

Question 6 (5 points)

In Java, which of the following access modifiers provides greatest access to an instance variable?

Question 6 options:

public

No modifier

protected

private

Save

Question 7 (5 points)

With process abstraction, what are the mechanisms for encapsulation and information hiding?

Question 7 options:

Classes encapsulate and the private modifier hides information

Subprograms encapsulate and the private modifier hides information

Classes encapsulate and local variables hide information

Subprograms encapsulate and local variables hide information

Save

Question 8 (5 points)

When is it critical to provide a destructor with a C++ abstract data type?

Question 8 options:

When any data member is static variable

When any data member is a variable allocated on the stack

When any data member is a variable allocated on the heap pointed to by an explicit pointer

When any data member is a constant allocated on the stack

Save

Question 9 (5 points)

In most languages that provide constructors or destructors, how are they named?

Question 9 options:

The programmer is free to choose the names

All constructors and destructors have predefined names

The constructor is named constructor and the destructor is named destructor

The names are based on the class name

Save

Question 10 (5 points)

Which of the following orderings of the encapsulation units of Java is ordered smallest to largest?

Question 10 options:

Method, class, package

Class, package, method

Package, class, method

Method, package, class

Save

Question 11 (5 points)

Which of the following encapsulation units is typically used to define only a single type?

Question 11 options:

C++ namespaces

Java packages

Ada packages

Java class

Save

Question 12 (5 points)

In which of the following languages is it customary to separate the specification from the implementation when defining an abstract data type?

Question 12 options:

Only C++

Java

C++ and Ada

C++ and Java

Save

Question 13 (5 points)

When using an abstract data type in a C++ client, which of the following should be used?

Question 13 options:

use

import

include

with

Save

Question 14 (5 points)

When defining an Ada abstract data type, where are the specification, representation and implementation customary placed, respectively?

Question 14 options:

All are placed in the package specification

Public part of package specification, private part of package specification, package body

Public part of package specification, private part of package body, package body

All are placed in the package body

Save

Question 15 (5 points)

Which of the following is a benefit of hiding the representation of the objects of an abstract data type?

Question 15 options:

It makes the program run faster

It insulates the client from specification changes

It insulates the client from representation changes

It makes the program shorter

Save

Question 16 (5 points)

Although parameterized abstract data types could be created in Java before version 5.0, what was the drawback to such collection classes?

Question 16 options:

Objects extracted from collections required upcasts

They required much more code

They ran much more slowly

Objects extracted from collections required downcasts

Save

Question 17 (5 points)

In which language is it not possible to instantiate a parameterized type with a primitive type?

Question 17 options:

C++

Java

C#

Ada 95

Save

Question 18 (5 points)

With data abstraction, what are the mechanisms for encapsulation and information hiding?

Question 18 options:

Subprograms encapsulate and the private modifier hides information

Classes encapsulate and local variables hide information

Subprograms encapsulate and local variables hide information

Classes encapsulate and the private modifier hides information

Save

Question 19 (5 points)

When defining a C++ abstract data type, in what files are the specification and implementation placed, respectively

Question 19 options:

.obj and .h files

.obj and .exe files

.h and .cpp files

.cpp and .h files

Save

Question 20 (5 points)

How many parameters does a default constructor have?

Question 20 options:

None

It is the programmer's choice

Exactly one

At least one

Save

Note: It is recommended that you save your response as you complete each question.

Explanation / Answer

Question 1)Which of the following features must a language contain to support the development of abstract data types?

answer is Information hiding.

Information hiding is a feature that a language contains to support the development of abstract data types.examples for languages that support the development of abstract datatypes is c++,java.

Question 2)Which of the following is not an encapsulation mechanism?

answer is A Java instance variable

A Java instance variable  is not an encapsulation mechanism.

Question 3)Information hiding is intended to hide which of the following features of a data type?

answer is The representation of the data type.

Information hiding is intended to hide the representation of the data type features of a data type.

Question 4)In most object-based languages, the reserved word private is provided to support which of the following?

answer is Information hiding.

In most object-based languages, the reserved word private is provided to support Information hiding.examples of object based languages are c++,java.

Question 5)Which of the following language features does not provide support for parameterized abstract data types?

answer is C function pointer parameters.

C function pointer parameters is the language features does not provide support for parameterized abstract data types

Question 6)In Java, which of the following access modifiers provides greatest access to an instance variable?

answer is public

Question 7)With process abstraction, what are the mechanisms for encapsulation and information hiding?

answer is Classes encapsulate and the private modifier hides information

Question 8)When is it critical to provide a destructor with a C++ abstract data type?

answer is When any data member is a variable allocated on the heap pointed to by an explicit pointer.

Question 9)In most languages that provide constructors or destructors, how are they named?

answer is The names are based on the class name

Question 10)Which of the following orderings of the encapsulation units of Java is ordered smallest to largest?

answer is Method, class, package

Question 11)Which of the following encapsulation units is typically used to define only a single type?

answer is Java class

Question 12) In which of the following languages is it customary to separate the specification from the implementation when defining an abstract data type?

answer is C++ and Ada

Question 13)When using an abstract data type in a C++ client, which of the following should be used?

answer is include

Question 14)When defining an Ada abstract data type, where are the specification, representation and implementation customary placed, respectively?

answer is Public part of package specification, private part of package specification, package body

Question 15)Which of the following is a benefit of hiding the representation of the objects of an abstract data type?

answer is It insulates the client from representation changes

Question 16)Although parameterized abstract data types could be created in Java before version 5.0, what was the drawback to such collection classes?

Answer is Objects extracted from collections required downcasts

Question 17)In which language is it not possible to instantiate a parameterized type with a primitive type?

answer is Java

Question 18)With data abstraction, what are the mechanisms for encapsulation and information hiding?

answer is Subprograms encapsulate and the private modifier hides information

Question 19)When defining a C++ abstract data type, in what files are the specification and implementation placed, respectively

answer is .obj and .h files

Question 20)How many parameters does a default constructor have?

answer is None