Professional Documents
Culture Documents
ANSWER: A
2. Which of the following is an example of a language that is based on the object-oriented paradigm?
ANSWER: D
ANSWER: A
4. Which of the following is not a type of statement found in a typical high-level imperative programming
language?
ANSWER: B
ANSWER: C
ANSWER: C
ANSWER: C
ANSWER: A
ANSWER: B
10. Which of the following is not associated with the concept of data type?
ANSWER: C
ANSWER: A
ANSWER: D
A. 4 B. 5 C. 6 D. 10
ANSWER: B
ANSWER: D
ANSWER: B
16. Which of the following is a means of nullifying conflicts among data types?
ANSWER: C
17. Which of the following is not constructed by a typical compiler?
ANSWER: A
18. Which of the following is a means of defining similar yet different classes in an object-oriented
program?
ANSWER: A
19. Which of the following is not a parse tree of an expression based on the following grammar?
A. B. C.
ANSWER: C
20. Which of the following statements is not a resolvent of the following clauses?
P OR Q OR R P OR T Q OR T R OR T
A. Q OR R OR T B. T OR P C. P OR R OR T D. Q OR T
ANSWER: B
21. Which of the following can Prolog conclude from the following program?
parent(jill, sue).
parent(jill, sally).
parent(john, sue).
parent(john, sally).
sibling(X, Y) :- parent(Z, X), parent(Z, Y).
ANSWER: C
Fill-in-the-blank/Short-answer Questions
1. In contrast to _______________ languages such as English and Spanish, programming languages are
2. List two disadvantages of both machine languages and assembly languages that are overcome by high-
level programming languages.
_____________________________________
_____________________________________
ANSWER: They are machine dependent and they require that algorithms be expressed in small machine-
related steps rather that larger application-oriented steps.
3. Indicate how each of the following types of programming languages is classified in terms of generation
(first generation, second generation, or third generation).
4. List four data types that occur as primitive types in many high-level programming languages.
____________________ ____________________
____________________ ____________________
ANSWER: Possible answers include: integer, real (or float), Boolean, and character.
5. What encoding system is commonly used to encode data of each of the following types?
A. Integer ___________________________
B. Real __________________________
C. Character ___________________________
6. A data structure in which all elements have the same type is called ___________________, whereas a
________________ may have elements of different types.
“2x” + “3x”
________________
ANSWER: “2x3x”
if (X == 5) goto 50
goto 60
50 print(Z)
goto 100
60 print(Y)
100 . . .
ANSWER: if (X == 5):
print(Z)
else:
print(Y)
9. The following is a program segment and the definition of a function named sub.
.
.
X = 3; def sub(Y):
sub(X) Y = 5;
print(X);
.
.
A. What value will be printed by the program segment if parameters are passed by value?
____________
B. What value will be printed by the program segment if parameters are passed by reference?
____________
ANSWER: A. 3 B. 5
10. The following is a program segment and the definition of a function named sub.
. def sub():
X = 8 .
sub() X = 2
print(X) .
. .
A. What value will be printed by the program segment if X of function sub is a global variable?
____________
B. What value will be printed by the program segment if X of function sub is a local variable?
____________
ANSWER: A. 8 B. 2
_____________________________________________________________________ .
ANSWER: the grammar allows more than one parse tree for a single string
12. List three items of information that would be contained in a typical parser’s symbol table.
________________________
________________________
________________________
ANSWER: Possible answers include: names of variables, data types associated with variables, data
structures associated with variables, and others.
13. Give three examples of key words that are often found in high-level imperative or object-oriented
languages.
ANSWER: Possible answers are numerous and include: if, while, for, class, int, etc.
14. In addition to the function’s name, what other information is contained in a typical function header?
____________________________________
15. In the context of the object-oriented paradigm, ____________ are templates from which
____________ are constructed. We say that the latter is an instance of the former.
16. In the context of the object-oriented paradigm, a __________________ is an imperative program unit
that describes how an object should react to a particular stimulus.
17. Based on the sketch of a class definition below, which methods can be invoked from outside an
instance of the class?
class Example
{public void method1( )
{ . . . }
private void method2( )
{ . . . }
Another random document with
no related content on Scribd:
There are no courses in this repast. You light a cigarette with your
first mouthful and smoke straight through: it is that kind of a
breakfast.
Then you spread yourself over space, flat on your back, the smoke
curling out through the half-drawn curtains. Soon your gondolier
gathers up the fragments, half a melon and the rest,—there is
always enough for two,—moves aft, and you hear the clink of the
glass and the swish of the siphon. Later you note the closely-eaten
crescents floating by, and the empty leaf. Giorgio was hungry too.
But the garden!—there is time for that. You soon discover that it is
unlike any other you know. There are no flower-beds and gravel
walks, and no brick fountains with the scantily dressed cast-iron boy
struggling with the green-painted dolphin, the water spurting from its
open mouth. There is water, of course, but it is down a deep well
with a great coping of marble, encircled by exquisite carvings and
mellow with mould; and there are low trellises of grapes, and a
tangle of climbing roses half concealing a weather-stained Cupid
with a broken arm. And there is an old-fashioned sun-dial, and sweet
smelling box cut into fantastic shapes, and a nest of an arbor so
thickly matted with leaves and interlaced branches that you think of
your Dulcinea at once. And there are marble benches and stone
steps, and at the farther end an old rusty gate through which Giorgio
brought the luncheon.
It is all so new to you, and so cool and restful! For the first time you
begin to realize that you are breathing the air of a City of Silence. No
hum of busy loom, no tramp of horse or rumble of wheel, no jar or
shock; only the voices that come over the water, and the plash of the
ripples as you pass. But the day is waning; into the sunlight once
more.
Giorgio is fast asleep; his arm across his face, his great broad chest
bared to the sky.
“Si, Signore!”
He is up in an instant, rubbing the sleep from his eyes, catching his
oar as he springs.
You glide in and out again, under marble bridges thronged with
people; along quays lined with boats; by caffè, church, and palace,
and so on to the broad water of the Public Garden.
But you do not land; some other day for that. You want the row back
up the canal, with the glory of the setting sun in your face. Suddenly,
as you turn, the sun is shut out: it is the great warship Stromboli,
lying at anchor off the garden wall; huge, solid as a fort, fine-lined as
a yacht, with exquisite detail of rail, mast, yard-arms, and gun
mountings, the light flashing from her polished brasses.
In a moment you are under her stern, and beyond, skirting the old
shipyard with the curious arch,—the one Whistler etched,—sheering
to avoid the little steamers puffing with modern pride, their noses
high in air at the gondolas; past the long quay of the Riva, where the
torpedo-boats lie tethered in a row, like swift horses eager for a
dash; past the fruit-boats dropping their sails for a short cut to the
market next the Rialto; past the long, low, ugly bath-house anchored
off the Dogana; past the wonderful, the matchless, the never-to-be-
unloved or forgotten, the most blessed, the Santa Maria della Salute.