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: 3852940 • 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

1) "Information hiding" is the only feature in the given options to support the term abstract data types.

2) Except "java instance variable" remaining all packages and namespaces can comes under encapsulation mechanism

3) Information hidding intended to hide "the representation of the data type" as it is a phisical storage type of data.

4) The term private suits for "Information hidding" since it allows to view only for a particular one, where as inheritance can't be private because values gets inherited and polymorphism takes the form of other so, it is also false.

5) "C function pointer parameters" can't be acceptable for abstract data types.

6) If a variable declared as "public" than it can access within class and sub classes within and outside the packages.protected also can access but through inheritance only.private limits to the class.

Among all Public has widest scope.

7) option "Subprograms encapsulate and local variables hide information" suits better based on their definitions.