Quiz
CS 4337 EXAM 3
This quiz has question types that open in the usual player.
Questions in this quiz (111)
1[Cadelli&Wegner1985] According to the authors, _____ polymorphism is so called because the uniformity of type structure is normally achieved by type parameters, but uniformity can be achieved in different ways, and this more general concept is called universal polymorphism.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
2[Cadelli&Wegner1985] According to the authors. Select the best choice for matching.
Overloading : [blank_start]D[blank_end]
Coercion: [blank_start]A[blank_end]
Subtyping: [blank_start]B[blank_end]
Value Sharing: [blank_start]C[blank_end]
All Answer Choices
A. an integer value can be used where a real is expected, and vice versa.
B. elements of a subrange type also belong to superrange types.
C. null pointer in C/C++ is a constant which is shared by all the pointer types.
D. integer constants may have both type integer and real. Operators such as + are applicable to both integer and real arguments.- AD
- BA
- CB
- DC
3[Cadelli&Wegner1985] According to the authors, ____ types are types whose operations are applicable to values of more than one type.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric inclusion
- Foverloading coercion
- Ginclusion
- Hcoercion
4[Cadelli&Wegner1985] According to the authors, conventional typed languages, such as Pascal, are based on the idea that functions and procedures, and hence their operands, have a unique type. Such languages are said to be ____, in the sense that every value and variable can be interpreted to be of one and only one type.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
5[Cadelli&Wegner1985] According to the authors: Consider the following example.
3+4
3+4.0
3.0+4
3.0+4.0
Here, the ad-hoc polymorphism of + can be explained in one of the following ways.
Which one of the following is NOT correct?- AThe operator + has four overloaded meanings, one for each of the four combinations of argument types.
- BThe operator + has two overloaded meanings, corresponding to integer and real addition.
- CWhen one of the argument is of type integer and the other is of type real, then the integer argument is coerced to the type real.
- DThe operator + is defined only for real addition, and integer arguments are always coerced to corresponding reals.
- EThe operator + has three overloaded meanings: one for integers, one for reals, and one for mixed argument types.
6[Cadelli&Wegner1985] According to the authors: In _____ polymorphism, a polymorphic function has an implicit or explicit type parameter, which determines the type of the argument for each application of that function.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
7[Cadelli&Wegner1985]
According to the authors, ____ allows type inconsistencies to be discovered at compile time and guarantees that executed programs are type-consistent.- ADynamically typed
- BInteractively typed
- CStatically typed
- DWeakly typed
- EUntyped
8[Cadelli&Wegner1985] According to the authors. Value sharing is a special case of _____ polymorphism. The fact that an object having many types is uniformly represented for all types is characteristic of _____ polymorphism.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
9[Cadelli&Wegner1985] According to the authors, parametric and inclusion polymorphism are classified as the two major subcategories of ____ polymorphism, which is contrasted with nonuniversal polymorphism.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
10[Cadelli&Wegner1985] According to the authors: There are also two major kinds of ad-hoc polymorphism. In ____ the same variable name is used to denote different functions, and the context is used to decide which function is denoted by a particular instance of the name.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dgeneric
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
11[Cadelli&Wegner1985] According to the authors, The following example is an example of an untyped universe.
- ABit strings in computer memory
- BS-expressions in pure Lisp
- Cλ-expressions in the λ-calculus
- DSets in set theory
- EPrimitive data types in Java
12[Cadelli&Wegner1985] According to the authors: In terms of implementation a universally polymorphic function will execute the ____ code for arguments of any admissible type, while an ad-hoc polymorphic function may execute ____ code for each type of argument.
- Astatic, dynamic
- Bsame, different
- Ctyped, untyped
- Dstack-based, heap-based
- Ecompile-time, run-time
- Fearly-binding, late-binding
13[Cadelli&Wegner1985] According to the authors, If a language is ____ its compiler can guarantee that the programs it accepts will execute without type errors.
- ADynamically typed
- BInteractively typed
- CStrongly typed
- DWeekly typed
- EUntyped
14[Cadelli&Wegner1985] According to the authors. Subtyping is an instance of ____ polymorphism.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
15[Cadelli&Wegner1985] According to the authors: The functions that exhibit ______ polymorphism are also called generic functions.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
16[Cadelli&Wegner1985] According to the authors.
_____ polymorphism is the purest form of polymorphism: the same object or function can be used uniformly in different type contexts without changes, coercions or any kind of run-time tests or special encodings of representations.- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
17[Cadelli&Wegner1985] According to the authors, Languages in which all expressions are type-consistent are called ____ languages.
- ADynamically typed
- BInteractively typed
- CStrongly typed
- DWeekly typed
- EUntyped
18[Cadelli&Wegner1985] According to the authors, "____" actually means that there is only one type.
- Adynamic type
- Bmany-typed
- Ctyped
- Dtypeless
- Eunityped
- Funtyped
19[Cadelli&Wegner1985]
According to the authors, which one of the following examples is the most concrete example of an untyped universe?- ABit strings in computer memory
- BS-expressions in pure Lisp
- Cλ-expressions in the λ-calculus
- DSets in set theory
- EObjects in Object Oriented Language
20[Cadelli&Wegner1985] According to the authors, universally polymorphic functions will normally work on an infinite number of types (all the types having a given common structure), while _____ polymorphic function will only work on a finite set of different and potentially unrelated types.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
21[Cadelli&Wegner1985] According to the authors. As is implicit in the choice of names, _____ polymorphism is considered true polymorphism.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
22[Cadelli&Wegner1985] According to the authors.
A language is object-oriented if and only if it satisfies the following requirements.
Which one of the following selections is NOT correct?- AIt supports objects that are data abstractions with an interface of named operations and a hidden local state
- BObjects have an associated object type
- CTypes may inherit attributes from supertypes
- Dobject-oriented = data abstractions + object types + type inheritance
- EObjects provide a capacity of encapsulation, message-passing, and information-hiding
23[Cadelli&Wegner1985] According to the authors, Strachey introduces a new form of polymorphism called _____ polymorphism, to model subtypes and inheritance, which is to model object-oriented programming.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
24[Cadelli&Wegner1985] According to the authors, ____ polymorphism is obtained when a function works uniformly on a range of types: these types normally exhibit some common structure.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
25[Cadelli&Wegner1985] According to the authors: a(n) ____ function is one which can work for arguments of many types, generally doing the same kind of work independently of the argument type. If we consider a(n) _____ function as a single value, it has many functional types and is therefore polymorphic. Select the best answer.
- Aprimitive
- Bmulti-typed
- Csingle-valued
- Dmultiple-valued
- Egeneric
- Fnon-generic
- Gstatic
- Hdynamic
26[Cadelli&Wegner1985] According to the authors: There are also two major kinds of ad-hoc polymorphism. A(n) _____ is instead a semantic operation which is needed to convert an argument to the type expected by a function, in a situation which would otherwise result in a type error.
- Amonomorphic
- Bpolymorphic
- Cuniform
- Dgeneric
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
27[Cadelli&Wegner1985] According to the authors, ____ polymorphism is obtained when a function works, or appears to work, on several different types (which may not exhibit a common structure) and may behave in unrelated ways for each type.
- Amonomorphic
- Bpolymorphic
- Cuniversal
- Dad-hoc
- Eparametric
- Foverloading
- Ginclusion
- Hcoercion
28[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
:- fail(test).- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
29
[ASP] move-win.
Consider the following program P, what is its answer set?
P = {
win(X) :- move(X,Y), not win(Y).
move(a,b).
move(b,c).
}- AOne answer: { }
- BOne answer: { win(a) }
- COne answer: { win(b) }
- DOne answer: { win(a), win(c) }
- ETwo answers: { win(a) }, { win(b) }
- FNo answer
30[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
{buy(pizza), buy(soda), buy(fruit)} :- at(grocery).- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
31(ASP) Concept.
Answer Set program to compute its solution(s) must ___.- Abe grounded.
- Bbe run as in First Order Logic
- Cbe pruned
- Dbe lifted
- Ebe modelled
32[ASP] concept.
Answer Set Programming is ___.- Abottom-up reasoning
- Btop-down reasoning
- Cgoal-driven reasoning
- Dmonotonic reasoning
- Enon-default reasoning
33[ASP] Reduct.
Consider the following set X of atoms and a program P, what is its reduct?
X = { q }
P = { p ← not q. q ← not p.}- A{ }
- B{ p. }
- C{ p ← not q. }
- D{ q. }
- E{ not q. }
34[ASP] move-win.
Consider the following program P, what is its answer set?
P = {
win(X) :- move(X,Y), not win(Y).
move(a,b).
move(b,a).
}- AOne answer: { }
- BOne answer: { win(a) }
- COne answer: { win(b) }
- DOne answer: { win(a), win(b) }
- ETwo answers: { win(a) }, { win(b) }
- FNo answer
35[ASP] simple program.
Consider the following program P, what is its answer set?
p ← p.- A{ p }
- B{ p ← p. }
- C{ p } and { not p }
- D{ }
36[ASP] syntax
Consider ASP syntax for a rule r, as shown below.
b1 or . . . or bm ← a1, . . . , an, not an+1, . . . , not an+k
Which one of the following selections is NOT correct?- AThe syntax for a rule r is for a normal program.
- Bn should be greater than 0.
- CIf n=k=0 then r is a fact
- DIf k=0, then r is a positive rule
- EIf m=0, then r is a constraint to be pruned out from answer.
37[ASP] (p,s,t)
Consider the following program P:
p :- not p, s, t.
s.
t.
What is its answer set(s)?- Ano answer set
- B1 answer set: { }
- C1 answer set: { p. }
- D1 answer set: { not p. }
- E1 answer set: { s, t }
38[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
10 {course(db)=6, course(ai)=6, course(xml)=3} 20- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
39[ASP] (p,s,t)
Consider the following program P. What is its answer set(s)?
p :- not p, s, t.- Ano answer set
- B1 answer set: { }
- C1 answer set: { p. }
- D1 answer set: { not p. }
- E1 answer set: { s, t }
40(ASP) Concept.
Answer Set semantics is based on ___.
Select the best answer.- AStable model
- BUnstable model
- CMonotonic model
- DFirst-Order model
- ENP-hard model
41[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
in(X,Y) :- number(X), box(Y), not not_in(X,Y).- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
42[ASP] (p,s,t)
Consider the following program P:
p :- not p, s, t.
p.
s.
t.
What is its answer set(s)?- Ano answer set
- B1 answer set: { }
- C1 answer set: { p. }
- D1 answer set: { not p. }
- E1 answer set: { s, t }
- F1 answer set: { p, s, t }
43[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
const n=10.
box(1..n).- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
44[ASP] Reduct.
Consider the following set X of atoms and a program P, what is its reduct?
X = { q }
P = { p ← not q. }- A{ }
- B{ p. }
- C{ p ← not q. }
- D{ q. }
- E{ not q. }
45[ASP] simple program.
Consider the following program P, what is its answer set?
p ← not q.
q ← not p.- AOne answer: { p }
- BOne answer: { q }
- CTwo answers: { p }, { q }
- DNo answer
- EOne answer: { }
46[ASP] move-win.
Consider the following program P. What is its answer set(s)?
win(X) :- move(X,Y), not win(Y).
move(a,b).
move(b,c).- ANo answer set
- B1 answer set: { }
- C1 answer set: { win(a). }
- D1 answer set: { win(b). }
- E1 answer set: { win(a). win(c). }
- F2 answer sets: { win(a). }, { win(b). }
- G2 answer sets: { win(a). win(c). }, { win(b). }
- H3 answer sets: { win(a). }, { win(b). }, { win(c). }
47[ASP] syntax
This is an example of ___ rule of Answer Set Programming.
pass(course) :- 2 {pass(test1), pass(test2), pass(test3)} 3.- Afact
- Bnormal rule
- Ccardinality rule
- Dweight rule
- Echoice rule
- Fconstraint rule
48(ASP) Concept.
Answer Set Programming is ___. Select the incorrect answer.- Adeclarative
- Blogic programming language
- Cusing bottom-up in problem solving strategy
- Done of functional programming languages
- Esuitable for nonmonotonic programming
49[ASP] simple program.
Consider the following program P, what is its answer set?
p ← not p.- AOne answer: { p }
- BOne answer: { q }
- CTwo answers: { p }, { q }
- DNo answer
- EOne answer: { }
50[ASP] move-win.
Consider the following program P, what is its answer set?
P = {
win(X) :- move(X,Y), not win(Y).
move(a,b).
}- AOne answer: { }
- BOne answer: { win(a) }
- COne answer: { win(b) }
- DOne answer: { win(a), win(b) }
- ETwo answers: { win(a) }, { win(b) }
- FNo answer
51[ASP] simple program.
Consider the following program P (with one fact p), what is its answer set?
p.- A{ p }
- B{ not p }
- C{ }
- Dno answer set
52[ASP] concept.
Which one of the following statements is NOT correct?- AHerbrand Universe of a program P is the set of ground terms constructed from function symbols and constants occurring in the program P.
- BHerbrand Base of a program P is the set of ground atoms constructed from predicate symbols and ground terms from the Herbrand Universe.
- CHerbrand Interpretation of a program P is the set of ground rules and facts constructed from Herbrand Base of P.
- DHerbrand Model of a program P is an instance of Herbrand Interpretation of P which is a model of P.
- EHerbrand Model of a program P is the subset of the Herbrand Interpretation of P, entailing P.
53[Concurrency in Unix/Linux C/C++]
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
fork(); fork(); fork();- A1
- B4
- C6
- D8
- E16
54[Concurrency in Unix/Linux C/C++]
After fork, the differences between the parent and child are:- AThe return values from fork
- BThe process file descriptors
- CThe content of process executable (text)
- DThe next instruction to be executed
- ENone of the above
55[Concurrency in Unix/Linux C/C++]
Given fork program as shown below, what would be the total number of processes at the end including the process running this program.
for (i=1; i < nprocs; i++) { childpid = fork(); }
When nprocs = 3, then the total number of processes after this code will be ____- A1
- B2
- C4
- D8
- E16
56[Concurrency in Unix/Linux C/C++]
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
if fork() fork();- A1
- B2
- C3
- D4
- E0
57[Concurrency in Unix/Linux C/C++]
After fork, the return value for the child is ___- A-1
- B0
- C+1
- Da new process ID for the child process
- Ethe process id of the parent process
58[Concurrency in Unix/Linux C/C++]
The new process created by fork is called the child process. This function is called once but returns ___.- Anone
- Bonce
- Ctwice
- Dthree times
- Eas many as needed
59[Concurrency in Unix/Linux C/C++]
___ is an executing instance of a program.- Aprocess
- Bthread
- Cpipe
- Dsignal
- Esocket
60[Concurrency in Unix/Linux C/C++]
Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
if (fork() < 0) {fork();}- A1
- B2
- C3
- D4
- E0
61[Concurrency in Unix/Linux C/C++]
When a process calls one of the ____ functions, that process is completely replaced by the new program, and the new program starts executing at its main function. It merely replaces the current process—its text, data, heap, and stack segments—with a brand-new program from disk.- Afork
- Bexec
- Cdup or dup2
- Dpipe
- Esocket
62[Concurrency in Unix/Linux C/C++]
___ will make a copy of the current process.- Aspawn
- Bclone
- Cthread
- Dfork
- Edup
63[Concurrency in Unix/Linux C/C++]
For a convenience, ___ call is used to execute a command string (e.g., "ls -la | wc") within a program.- Athread
- Bprocess
- Cpipe
- Dfork
- Esystem
64[Concurrency in Unix/Linux C/C++]
___ is a lightweight process- Achild process
- Bprocess
- Cthread
- Dsocket
- Ehandler
65[Concurrency in Unix/Linux C/C++]
All ___ within a process share the same address space, file descriptors, stacks, and process-related attributes.- Aprocesses
- Bthreads
- Cpipes
- Dsockets
- Esemaphores
66[Concurrency in Unix/Linux C/C++]
After fork, the return value for the parent process is ___- A-1
- B0
- C+1
- Dthe child process id
- Ethe process id of the parent process
67[Concurrency in Unix/Linux C/C++]
A(n) ___ has only one thread of control—one set of machine instructions executing at a time.- Apipe
- Bprocess
- Cprogram
- Dsignal
- Esocket
68In C#, a(n) ____ subroutine is an instance of a delegate type.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
69To implement a(n) ___ in C++, an object of a class that overrides operator ( ) can be called as if it were a function.
- Aabstract class
- Bparametric object
- Cpolymorphic object
- Dstandard template object
- Esubtype class
- Fobject closure
- Gobject template
70___ subroutines in a language with nested scopes introduce an additional level of complexity: they raise the possibility that a reference to a subroutine may outlive the execution of the scope in which that routine was declared.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
71Languages that support object-oriented programming usually support ____ polymorphism.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
72____ polymorphism is provided by a subprogram that takes generic parameters that are used in type expressions that describe the types of the parameters of the subprogram.
- Aad-hoc
- Binheritance
- Cparametric
- Dabstract
- Egeneral
73____ polymorphism is fundamental to object-oriented languages, in which classes are said to inherit the methods of their parent classes.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
74_____ polymorphism is also called explicit parametric polymorphism.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
75In Java, the expression <T extends BoundingType> specifies that T should be a(n) ____ of the bounding type.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
76A(n) ___ is a view or representation of an entity that includes only the most significant attributes.
- Aabstraction
- Bpolymorphism
- Cencapsulation
- Dinheritance
- Egeneric
77In general, a value in a programming language is said to have ___ status if it can be passed as a parameter, returned from a subroutine, or assigned into a variable.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
78Parametrically polymorphic subprograms are often called _____ subprograms.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
79___ is a subprogram and the referencing environment where it was defined.
- Aclass
- Bobject
- Cparameter
- Dtemplate
- Einterface
- Fclosure
- Gmethod
80As an extension of the module-as-type approach to data abstraction, many languages now provide a class construct for object-oriented programming. To first approximation, classes can be thought of as module types that have been augmented with a(n) _____ mechanism.
- Atype
- Babstraction
- Cinheritance
- Dencapsulation
- Enone of the above
81In Java, for generic class<T>, T is the ___ variable.
- Aad-hoc
- Btype
- Cpolymorphic
- Dfirst-class
- Eprimitive
82In Java (versus C++), generic parameters must be classes—they cannot be ____ types.
- Afree
- Bsubtype
- Cpolymorphic
- Dgeneric
- Eprimitive
83_____ polymorphism is usually, though not always, implemented by creating multiple copies of the polymorphic code, one specialized for each needed concrete type.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
84___ is the process by which a compiler automatically converts a value of one type into a value of another type when that second type is required by the surrounding context.
- Acasting
- Bcoercion
- Cauto-type
- Ddefaulting
- Enone of the above
85____ polymorphism means that a variable of type T can access any object of type T or any type derived from T.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
86As Subroutines display most variation. They are ___ values in all functional programming languages and most scripting languages. They are also ___ values in C# and, with some restrictions, in several other imperative languages, including Fortran, Modula-2 and -3, Ada 95, C, and C++.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
87Function object or functor is another name for ____ time to time.
- Aabstract class
- Bparametric object
- Cpolymorphic object
- Dstandard template object
- Esubtype class
- Fobject closure
- Gobject template
88In Java, if a generic method has two or more restrictions on its generic type, they are added to the extends-clause, separated by _____.
- Acomma
- Bsemicolon
- Campersand
- Dplus
- Estar
89___ value cannot be passed as a parameter.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
90___ value can be passed as a parameter, but not returned from a subroutine or assigned into a variable.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
91Labels are ___ values in most programming languages as it cannot be passed as a parameter.
- Afirst-class
- Bsecond-class
- Cthird-class
- Dfourth-class
- Eparametric
- Fpolymorphic
- Gsubclass
- Had-hoc
92The evolution of data ____ began in 1960 with the first version of COBOL, which included the record data structure. The C-based languages have structs, which are also records.
- Aabstraction
- Bpolymorphism
- Cencapsulation
- Dinheritance
- Egeneric
93In OOPL, we can encapsulate our subroutine as a method of a simple object, and let the object’s fields hold context for the method. An object that plays the role of a function and its referencing environment may variously be called ___.
- Aabstract class
- Bparametric object
- Cpolymorphic object
- Dstandard template object
- Esubtype class
- Fobject closure
- Gobject template
94All subprograms are process ____(s) because they provide a way for a program to specify a process, without providing the details of how it performs its task (at least in the calling program).
- Aabstraction
- Bpolymorphism
- Cencapsulation
- Dinheritance
- Egeneric
95Overloaded subprograms provide a particular kind of polymorphism called ___ polymorphism.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
96Java 5.0 supports ____ types which can be used for any collection type of any class components.
- Abound
- Bgeneric
- Cpolymorphic
- Dwildcard
- Eprimitive
97In Java, restrictions can be specified on the range of classes that can be passed to the generic method as generic parameters. Such restrictions are called ____.
- Abound
- Bnon-free
- Cpolymorphic
- Dwildcard
- Eprimitive
98In Java 5.0, it supports for ____ types and methods to Java. The name of a(n) ___ class in Java 5.0 is specified by a name followed by one or more type variables delimited by pointed brackets.
- Aad-hoc
- Bgeneric
- Cinheritance
- Dsubtype
- Esupertype
99For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
This can declare abstract methods: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface- ANo, No, No
- BNo, Yes, No
- CNo, No, Yes
- DNo, Yes, Yes
- ENone of the above
100Java. Visibility in explicit way: private, protected, public, or default (package).
Select the best choice(s) for (5) where there are three answers. (Any wrong answer may result in negative score).
Java Visibility Chart
Visibility........................| Applied to Classes....| Applied to Class Members
Default or package.....| (1)................................| (2)
Public ..........................| (3).................................| (4)
Protected.....................| (5)................................| (6)
Private..........................| (7)................................| (8)
- AVisible to all classes where the class defining the member must also be public.
- BApplicable to inner classes
- CVisible to all classes.
- DVisible only within this class
- EAccessible only to members of the class in which it is declared.
- FVisible to classes outside the package that extend this class.
- GVisible to classes in this package
101Java (Matching Problem).
Select one best choice for each question below.
Question
this is for garbage collection (to destroy) _______ [blank_start]C[blank_end]
this is for the procedure after catch-throw ______ [blank_start]A[blank_end]
this is to declare a constant _____________________ [blank_start]H[blank_end]
All Answer Choices
A. finally
B. serialize
C. finalize
D. const
E. exeption
F. garbageCollection
G. destroy
H. final
I. throwable- AC
- BA
- CH
102Select one best choice for your answer, for C++ access control (as discussed in the class).
What is the access specification for X, Y, Z defined in A as shown below, in class B, C, and D. Select each from the following choice of:
Table:
In Base Class A ..............| class B : public A ......| class C : protected A .......| class D : private A
.... public : int X; .............| X is __ [blank_start]A[blank_end] __ in B .........| X is __ [blank_start]D[blank_end] __ in C ................| X is __ [blank_start]G[blank_end] __ in D
.... protected: int Y; ........| Y is __ [blank_start]D[blank_end] __ in B ........| Y is __ [blank_start]D[blank_end] __ in C .................| Y is __ [blank_start]G[blank_end] __ in D
.... private : int Z; ............| Z is __ [blank_start]B[blank_end] __ in B ........| Z is __ [blank_start]B[blank_end] __ in C .................| Z is __ [blank_start]B[blank_end] __ in D
All Answer Choices
A.
public
B.
not accessible
C.
compile-time error
D.
protected
E.
none of the above
F.
run-time error
G.
private
- AA
- BD
- CB
- DD
- ED
- FB
- GG
- HG
- IB
103For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
This can extend another class: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface- AYes, No, No
- BYes, Yes, No
- CYes, No, Yes
- DYes, Yes, Yes
- ENone of the above
104For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
Instances (objects) of this can be created: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface- AYes, No, No
- BYes, Yes, No
- CYes, No, Yes
- DYes, Yes, Yes
- ENone of the above
105Java. Visibility in explicit way: private, protected, public, or default (package).
Select the best choices for (7) where there are two answers.
Java Visibility Chart
Visibility ........................| Applied to classes ......| Applied to Class Members
Default or package .....| (1) .................................| (2)
Public ............................| (3) .................................| (4)
Protected .....................| (5) ..................................| (6)
Private ..........................| (7) ..................................| (8)
- AApplicable to inner classes
- BAccessible only to members of the class in which it is declared.
- CVisible to classes in this package
- DVisible to classes outside the package that extend this class.
- EVisible to all classes.
- FVisible only within this class
- GVisible to all classes where the class defining the member must also be public.
106For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
Variables of this type can be declared: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface.- AYes, No, No
- BYes, Yes, No
- CYes, No, Yes
- DYes, Yes, Yes
- ENone of the above
107For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for "these".
The number of these a class implement: (1) ___ (Actual Class), (2) ___ (Abstract Class), (3) ___ (Interface).
Question
Actual Class ________ [blank_start]A[blank_end]
Abstract Class ______ [blank_start]A[blank_end]
Interface ___________ [blank_start]B[blank_end]
All Answer Choices
A. 0
B. Any number
C. None of the above
D. 1
E. 1 or more
F. 0 or 1- AA
- BA
- CB
108For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for "these".
The number of these a class can extend: (1) ___ (Actual Class), (2) ___ (Abstract Class), (3) ___ (Interface).
Question
for Actual Class __________ [blank_start]A[blank_end]
for Abstract Class ________ [blank_start]A[blank_end]
for Interface _____________ [blank_start]C[blank_end]
All Answer Choices
A. 0 or 1
B. None of the above
C. 0
D. Any number
E. 1
F. 1 or more- AA
- BA
- CC
109For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
This can define instance variables and methods: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface- AYes, No, No
- BYes, Yes, No
- CYes, No, Yes
- DYes, Yes, Yes
- ENone of the above
110For Java – (1) actual class, (2) abstract class, and (3) interface, answer properly and best for what is "this".
This can define constants: (1) ___ for Actual Class, (2) ___ for Abstract Class, (3) ___ for Interface- AYes, No, No
- BYes, Yes, No
- CYes, No, Yes
- DYes, Yes, Yes
- ENone of the above
111Java. Visibility in explicit way: private, protected, public, or default (package).
Select the best choice(s) for (6) where there are two answers to be selected. Any wrong answer will have a negative score.
Java Visibility Chart
Visibility ........................| Applied to classes ......| Applied to Class Members
Default or package .....| (1) .................................| (2)
Public ............................| (3) .................................| (4)
Protected .....................| (5) ..................................| (6)
Private ..........................| (7) ..................................| (8)
- AAccessible only to members of the class in which it is declared.
- BVisible to all classes.
- CVisible to all classes where the class defining the member must also be public.
- DVisible to classes outside the package that extend this class.
- EApplicable to inner classes
- FVisible to classes in this package
- GVisible only within this class
Information
- Description
- Computer Science Quiz on CS 4337 EXAM 3, created by Tracey Powell on 28/11/2016.
- Author
- Tracey Powell
- Language
- English
- Views
- 1
- Tags
- Rating
- No ratings yet Rate this quiz