stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Programming and Logic II Review 2 Flashcards | StudBud
Explore
/
Programming and Logic II Review 2
Programming and Logic II Review 2
25 terms
·
StudBud Administration
·
32 plays
Programming and Logic II Review
Flashcards
25 cards
F
Practice quiz
P
Host live
L
Questions
25
Answers
1
What will be the value of x after the following code is executed?
210
110
This is an infinite loop
90
2
What will be the value of x after the following code is executed?
15
60
75
135
3
What are methods that operate on an object's fields?
instance methods
instance variables
public methods
private methods
4
What will be the values of ans, x, and y after the following statements execute?
ans=45,x=50,y=0
ans=60,x=50,y=100
ans=60,x=0,y=50
ans=45,x=50,y=50
5
What value signals when the end of a list of values has been reached?
end value
final value
sentinel value
terminal value
6
Think of a _______ as a cookie cutter and ________ as the cookies.
class; objects
class; fields
object; classes
field; methods
7
Which mathematical operator is used to raise five tot he second power?
~
MOD
/
^
8
Which of the following is true of a constructor?
has the same name as the class
always has an access specifier of private
always accepts two arguments
has return type void
9
Which of the following expressions will determine whether x is less than or equal to y?
x >= y
x > y
x =< y
x <= Y
10
Use this type of loop in situations where the exact number of iterations is known.
do-while loop
if statement
while loop
for loop
11
What will be the value of ans after the following code has been executed?
20
145
10
No value, there is a syntax error
12
10110000 is an example of an instruction written in which computer language?
Machine language
Assembly language
C#
Python
13
What will be the value of x after the following code is executed?
110
100
90
This is an infinite loop
14
The ___________ statement is used to make simple decision in Java
for
switch
do-while
if
15
How many times will the following for loop be executed?
12
11
0
10
16
What does the keyword new do?
creates an object in memory
creates a new Java byte code file
creates a new variable in memory
creates a new class
17
Before entering a loop to compute a running total, the program should first
set the accumulator to 0
read all the values into main memory
know exactly how many values there are to total
set all variables to 0
18
The decision structure that has two possible paths of execution is known as _______.
two alternative
double alternative
single alternative
dual alternative
19
What does a UML diagram not contain?
object names
fields
methods
class name
20
What will be the value of bonus after the following code is executed?
1250
1000
750
500
21
Class objects have __________ that perform useful operations on their data.
instances
relationships
methods
fields
22
What will be the values of x and y as a result of the following code?
x=25,y=8
x=34,y=9
x=33,y=9
x=33,y=8
23
A loop that does not stop is called _____________.
an infinite loop
a while loop
a for loop
a do-while loop
24
Which loop repeats a specific number of times?
infinite loop
sentinel loop
conditional loop
count-controlled loop
25
What will be the value of ans after the following code has been executed?
No value, there is a syntax error
120
10
100