CS_4402_Graded_Quiz_Unit_6
CS_4402_Graded_Quiz_Unit_6
00
Grade 100.00 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
A programming language is said to support object oriented programming if it includes all of the following constructs EXCEPT:
Select one:
a. Encapsulation and data abstraction
b. Inheritance
c. Dynamic polymorphism
d. Data Abstraction
Question 2
Correct
Mark 1.00 out of 1.00
Select one:
a. state and behavior
b. methods and attributes
c. variables and behaviors
d. instances and allocations
Select one:
a. Perl
b. Python
c. Rexx
d. Haskell
Question 4
Correct
Mark 1.00 out of 1.00
The ability to select the appropriate subprogram at run-time based upon an evaluation of types is known as? (NOTE: there are 4
possible answers and you can specify any of the 4).
Question 5
Correct
Mark 1.00 out of 1.00
What type of command repeatedly executes the program body (or a block) to determine when execution should stop?
Select one:
a. Iterative command
b. Simultaneous command
c. Definitive command
d. Assignment command
Given that n and count are both of type int, which statement is true about the following code segments?
II count = 1;
while (count <= n)
{
System.out.println(count);
count++;
}
Select one:
a. I and II are exactly equivalent for all input values of n.
b. I and II are exactly equivalent for all input values n>= 1, but differ when n<= 0.
c. I and II are exactly equivalent only when n = 0.
d. I and II are exactly equivalent only when n is even.
e. I and II are not equivalent for any input values of n.
The correct answer is: I and II are exactly equivalent for all input values of n.
Question 7
Correct
Mark 1.00 out of 1.00
The following fragment intends that a user will enter a list of positive integers at the keyboard and terminate the list with a sentinel:
int value = 0;
final int SENTINEL = -999;
while(value != SENTINEL)
{
// code to process value
value = IO.readInt();
}
Select one:
a. The sentinel gets processed
b. The last nonsentinel value entered in the list fails to get processed.
c. A poor choice of SENTINEL value causes the loop to terminate before all values have been processed.
d. The code will always process a value that is not on the list
e. Entering the SENTINEL value as the first value causes a run-time error.
The correct answer is: The code will always process a value that is not on the list
Question 8
Correct
Mark 1.00 out of 1.00
Select one:
a. Selection
b. Iteration
c. Recursion
d. Concurrency
The output of compilation is code generation which typically translates a language construct into assembly language and from there
into machine executable code. What language construct was the following segment of assembler code generated from?
compute R1,expression
jump.eq R1,L1
statement-1
jump L2
L1: statement-2
L2:
Select one:
a. while statement
b. for loop statement
c. case statement
d. if statement
Question 10
Correct
Mark 1.00 out of 1.00
Select one:
a. A strong password
b. A phone number field
c. An email address
d. The URL of a web site
Select one:
a. sequence
b. selection
c. imperative programming
d. repetition
Question 12
Correct
Mark 1.00 out of 1.00
True/False: Perl was originally developed by Linus Trovalds as a scripting language for Windows.
Select one:
True
False
Question 13
Correct
Mark 1.00 out of 1.00
What command is used to distinguish the imperative programming languages from other programming languages?
Select one:
a. Assignment command
b. Simultaneous command
c. Iterative command
d. Definitive command
True/False: An algorithm can often be implemented with either recursion or iteration, however iteration typically takes less memory.
Select one:
True
False
Question 15
Correct
Mark 1.00 out of 1.00
Select one:
a. a direct recursive call
b. an indirect recursive call
c. a nested function call
d. functional programming
my @a = split();
Select one:
a. ' ', 'a', ' ', 'b', ' ', 'c', ' '
b. undef, 'a', 'b', 'c', undef
c. 'a', 'b', 'c'
d. ' ', 'a', 'b', 'c'
Question 17
Correct
Mark 1.00 out of 1.00
Which of the following regex expressions would match the following: MyDogIs12
Select one:
a. {a-z}{A-Z}{0-9}
b. [a-zA-Z]
c. [a-z0-9]
d. [a-zA-Z0-9]
Select one:
True
False
Question 19
Correct
Mark 1.00 out of 1.00
Select one:
a. Java Virtual Machine
b. Java Virtual Processor
c. Java Interpreter
d. Java interceptor
What values are stored in x and y after execution of the following program segment?
Select one:
a. x=30 y=60
b. x=30 y=90
c. x=-30 y=30
d. x=3 y=-3
e. x=30 y=40
if n is of type int and has a value of 0 when the segment is executed, what will happen?
Select one:
a. Neither statement1 nor statement2 will be executed; control will pass to the first statement following the if statement
b. A syntax error will occur
c. statement1, but not statement2, will be executed
d. statement2, but not statement1 will be executed
The correct answer is: statement2, but not statement1 will be executed
Question 22
Correct
Mark 1.00 out of 1.00
True/False: The real disadvantage of call-by-reference is that the mechanism is inherently unsafe.
Select one:
True
False
True/False: The ability of the compiler to select, at compile time, the most appropriate data type or method to use based upon data
type is known as dynamic polymorphism?
Select one:
True
False
Question 24
Correct
Mark 1.00 out of 1.00
In programming languages, which category must make the appropriate decision at run-time between two or more statements or
expressions that occur within a program?
Select one:
a. Selection
b. Iteration
c. Recursion
d. Sequence
The following segment of code in Perl produces the ouput 2. This indicates that Perl is.
print 1+"1"
Select one:
a. weakly typed
b. strongly typed
c. dynamically scoped
d. compiled