1/73
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Java is a
high level language
The software used to enter Java program statements into a computer is called a
a text editor or IDE
Windows 7, UNIX, and LINUX are examples of
operating systems
The software that converts a java source program to a low-level bytecode program is
a compiler
Comments in Java
all of these
In developing a program, writing the Java code is done after
writing the algorithm
Syntax and logic errors are detected as follows
syntax errors are caught by the compiler; logic errors are caught by the programmer
A prompt is a message which
directs a person to enter something from the terminal
A programmer-defined identifier whose data value is expected to change during the program’s execution is a
variable
A semicolon missing at the end of a java statement is a
syntax error
The computer really only understands
Binary
The inclusion of main() in a Java program is
always necessary
Which variable name is syntactically correct in java?
OakStreet
Which of the following is NOT a Java primitive data type?
String
What is the output from this code?
int x = 0;
System.out.print(x++);
0
Evaluate the following expression using the precedence of arithmetic operators used by the Java language:
10 - 2 * 4 + 6 / 2
5
Evaluate the following expression:
x = 7 % (5/2)
1
Looping is a process that can be controlled by
both a and b
The primary basic control structures in a structured language are
Sequence, selection, repetition, invocation
When the Java compiler interprets a nested if statement, an else is always paired with the closest preceding non-paired if
True
Storing a value in Java is accomplished by
an assignment statement
A group of related items of the same type is best stored in
an array
An if statement’s alternative path is implemented with
else
The Java statement to copy the value stored in inamt to outamt is
Outamt = inamt;
A java expression is/are
variable and/or numbers seperated by operators
Assuming a = 10.6, b=13.9 and c =3,42, what is the value of int (a+b+c)?
27
The result of evaluating the expression X / Y * 3 where X is an integer that contains 10 and Y is an integer that contains 4 is
6
When executing a while loop, the condition test is performed
first
When executing a do-while loop, the condition test is performed
last
Convert the following statements to Java: If the semester grade is less than 60, the letter is F.
If the grade is between 60 and 90, the letter is C
If the is over 90, the letter is A
if(grade =60)
letter = ‘F’;
Else if(grade)>=60 && grade <=90)
letter = ‘C’
else
letter=’A’
Which expression listed below could be used to replace the expression if(val <=30) (if val is an int) and not change the behavior of the program
if(val<31)
Consider the following Java program segment
x=1;
while x<6)
System.out.print(x)
After completion of loop
This is an endless loop
The Java statement that could be used to count the number of records processed is
recs = 1 + recs;
Readability of a program is enhanced by
all of these
The subscript of an array can be of any data type
false
Which of the following sets all the elements to a five-element array to the value 9
int [] a = {9,9,9,9,9};
In Java a String variable stores a reference to a collection of characters
true
A data file
is a collection of data stored under a common name on a device other than main memory
Arguments to methods and their corresponding parameters
should logically represent the same information
Sending data to a method is called
passing arguments
Which of the following defines a 20 element array of floating point numbers?
float [] x = new float (20)
To pass an individual element of an array to a method you must specify
the name of the array and the element number as one argument
The set of hexadecimal digits are
0-F
5 + 5 = 10 in
decimal
In the ____ numbering system 77 + 1 = 100
octal
___ is used to group four binary digits to make one digit for ease in reading binary notation
hexadecimal
The octal equivalent of the binary number 110101111 is
657
1010 would be a valid number in
all of the above bases
The powers of the base represent the place values in
all of the above bases
The step-by step solution to a problem is called
an algorithm
set loop count to 1
While loop count is less than or equal to 10
read a number
if the number is not greater than 100
square the number
print the number and the square of the number
on a new line
end if
increment loop county by 1
end while
Assume the following data was used
4 5 2 1 100 200 600 5 6 22 50 4 2 1 4 101 99
How many data items would be read from the data supplied?
10
set loop count to 1
While loop count is less than or equal to 10
read a number
if the number is not greater than 100
square the number
print the number and the square of the number
on a new line
end if
increment loop county by 1
end while
Assume the following data was used
4 5 2 1 100 200 600 5 6 22 50 4 2 1 4 101 99
How many lines of output would be generated?
8
set loop count to 1
While loop count is less than or equal to 10
read a number
if the number is not greater than 100
square the number
print the number and the square of the number
on a new line
end if
increment loop county by 1
end while
Assume the following data was used
4 5 2 1 100 200 600 5 6 22 50 4 2 1 4 101 99
The logic indicated that any data item larger than 100 will
be read but not squared if it is within the first 10 items
set loop count to 1
While loop count is less than or equal to 10
read a number
if the number is not greater than 100
square the number
print the number and the square of the number
on a new line
end if
increment loop county by 1
end while
Assume the following data was used
4 5 2 1 100 200 600 5 6 22 50 4 2 1 4 101 99
The above pseudocode is an example of a ___ controlled
a counter
set loop count to 1
While loop count is less than or equal to 10
read a number
if the number is not greater than 100
square the number
print the number and the square of the number
on a new line
end if
increment loop county by 1
end while
Assume the following data was used
4 5 2 1 100 200 600 5 6 22 50 4 2 1 4 101 99
Implementation of this logic would
require the use of selection, sequence, and repitition structures
The byte primitive data type can store
A range of integers from -128 to +127
Given the decimal number 37, the binary equivalent is
100101
The Java code to increment ctr by 1 to 200 is
ctr = 0
while (ctr < 200)
ctr = ctr +1;
Consider the following Java program segment
int count - 0
for (int i = 0; i<3, ++i)
for (int j = 0; j < 6, ++j)
++count;
system.out.print(count)
The output generated by this program is
18
What values of P, Q, and R would yield a result of true for the expression
P && (!(Q || R))?
true, false, false
Public class test1
{
public static void main(String [] args)
{
Int x = 10
Int y = 20
myfunction(1,2);
System.out.println(“x = “ + x + “ , y = “ y);
X++;
}
Public static void myfunction (int x, int x)
{
System.out.println(“x = “ + x + “ , y = “ y);
}}
The first line of output from the program is
x=1, y=2
Public class test1
{
public static void main(String [] args)
{
Int x = 10
Int y = 20
myfunction(1,2);
System.out.println(“x = “ + x + “ , y = “ y);
X++;
}
Public static void myfunction (int x, int x)
{
System.out.println(“x = “ + x + “ , y = “ y);
}}
The second line of output from the program is
x=10, y=20
Public class test1
{
public static void main(String [] args)
{
Int x = 10
Int y = 20
myfunction(1,2);
System.out.println(“x = “ + x + “ , y = “ y);
X++;
}
Public static void myfunction (int x, int x)
{
System.out.println(“x = “ + x + “ , y = “ y);
}}
Which of the following are arguments passed into
value_a, value_b
Public class test1
{
public static void main(String [] args)
{
Int x = 10
Int y = 20
myfunction(1,2);
System.out.println(“x = “ + x + “ , y = “ y);
X++;
}
Public static void myfunction (int x, int x)
{
System.out.println(“x = “ + x + “ , y = “ y);
}}
If 15.0 were entered for value_a and 2.0 was enetered for value_b, what would the output be?
0.0
Public class test1
{
public static void main(String [] args)
{
Int x = 10
Int y = 20
myfunction(1,2);
System.out.println(“x = “ + x + “ , y = “ y);
X++;
}
Public static void myfunction (int x, int x)
{
System.out.println(“x = “ + x + “ , y = “ y);
}}
If the line x = find_x(value_a, value_b); was replaced with find_x(value_a, value_b_
0.0
Study the flowchart then answer the questions 66 to 70.
The counter-controlled loop indicated in the flowchart could be implemented in Java with ___
the while statement
Study the flowchart then answer the questions 66 to 70.
The variable J is initialized, increment and tested with
a literal or constant
Study the flowchart then answer the questions 66 to 70.
This logic will produce _ lines of output
1
Study the flowchart then answer the questions 66 to 70.
The second loop of this flowchart is actually an example of
finding the largest value
Study the flowchart then answer the questions 66 to 70.
The statement that best indicated the purpose of this flowchart is
determines and prints the largest of five data items
How many times will the while loops be executed
5
What is the maximum number of scores that can be processed by this program
7
At the end of execution, what are the values stored in the array?
[90, 50, 98, 70, 68, 0, 0]
Which of the following best describes what this program does?
prints out the scores in reverse order stored in the array