CISC115 FInal Exam Review Questions

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/73

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

74 Terms

1
New cards

Java is a

high level language

2
New cards

The software used to enter Java program statements into a computer is called a

a text editor or IDE

3
New cards

Windows 7, UNIX, and LINUX are examples of

operating systems

4
New cards

The software that converts a java source program to a low-level bytecode program is

a compiler

5
New cards

Comments in Java

all of these

6
New cards

In developing a program, writing the Java code is done after

writing the algorithm

7
New cards

Syntax and logic errors are detected as follows

syntax errors are caught by the compiler; logic errors are caught by the programmer

8
New cards

A prompt is a message which

directs a person to enter something from the terminal

9
New cards

A programmer-defined identifier whose data value is expected to change during the program’s execution is a

variable

10
New cards

A semicolon missing at the end of a java statement is a

syntax error

11
New cards

The computer really only understands

Binary

12
New cards

The inclusion of main() in a Java program is

always necessary

13
New cards

Which variable name is syntactically correct in java?

OakStreet

14
New cards

Which of the following is NOT a Java primitive data type?

String

15
New cards

What is the output from this code?
int x = 0;

System.out.print(x++);

0

16
New cards

Evaluate the following expression using the precedence of arithmetic operators used by the Java language:

10 - 2 * 4 + 6 / 2

5

17
New cards

Evaluate the following expression:
x = 7 % (5/2)

1

18
New cards

 Looping is a process that can be controlled by

both a and b

19
New cards

The primary basic control structures in a structured language are

Sequence, selection, repetition, invocation

20
New cards

When the Java compiler interprets a nested if statement, an else is always paired with the closest preceding non-paired if

True

21
New cards

Storing a value in Java is accomplished by

an assignment statement

22
New cards

A group of related items of the same type is best stored in

an array

23
New cards

An if statement’s alternative path is implemented with

else

24
New cards

The Java statement to copy the value stored in inamt to outamt is

Outamt = inamt;

25
New cards

A java expression is/are

variable and/or numbers seperated by operators

26
New cards

Assuming a = 10.6, b=13.9 and c =3,42, what is the value of int (a+b+c)?

27

27
New cards

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

28
New cards

When executing a while loop, the condition test is performed

first

29
New cards

When executing a do-while loop, the condition test is performed

last

30
New cards

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’

31
New cards

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)

32
New cards

Consider the following Java program segment

x=1;

while x<6)

System.out.print(x)

After completion of loop

This is an endless loop

33
New cards

The Java statement that could be used to count the number of records processed is

recs = 1 + recs;

34
New cards

Readability of a program is enhanced by

all of these

35
New cards

The subscript of an array can be of any data type

false

36
New cards

Which of the following sets all the elements to a five-element array to the value 9

int [] a = {9,9,9,9,9};

37
New cards

In Java a String variable stores a reference to a collection of characters

true

38
New cards

A data file

is a collection of data stored under a common name on a device other than main memory

39
New cards

Arguments to methods and their corresponding parameters

should logically represent the same information

40
New cards

Sending data to a method is called

passing arguments

41
New cards

Which of the following defines a 20 element array of floating point numbers?

float [] x = new float (20)

42
New cards

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

43
New cards

The set of hexadecimal digits are

0-F

44
New cards

5 + 5 = 10 in

decimal

45
New cards

In the ____ numbering system 77 + 1 = 100

octal

46
New cards

 ___ is used to group four binary digits to make one digit for ease in reading binary notation

hexadecimal

47
New cards

The octal equivalent of the binary number 110101111 is

657

48
New cards

1010 would be a valid number in

all of the above bases

49
New cards

The powers of the base represent the place values in

all of the above bases

50
New cards

The step-by step solution to a problem is called

an algorithm

51
New cards

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

52
New cards

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

53
New cards

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

54
New cards

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

55
New cards

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

56
New cards

The byte primitive data type can store

A range of integers from -128 to +127

57
New cards

Given the decimal number 37, the binary equivalent is

100101

58
New cards

The Java code to increment ctr by 1 to 200 is

ctr = 0

while (ctr < 200)

ctr = ctr +1;

59
New cards

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

60
New cards

What values of P, Q, and R would yield a result of true for the expression 

P && (!(Q || R))?

true, false, false

61
New cards

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

62
New cards

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

63
New cards

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

64
New cards

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

65
New cards

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

66
New cards

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

67
New cards

Study the flowchart then answer the questions 66 to 70.
The variable J is initialized, increment and tested with

a literal or constant

68
New cards

Study the flowchart then answer the questions 66 to 70.
This logic will produce _ lines of output

1

69
New cards

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

70
New cards

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

71
New cards

How many times will the while loops be executed

5

72
New cards

What is the maximum number of scores that can be processed by this program

7

73
New cards

At the end of execution, what are the values stored in the array?

[90, 50, 98, 70, 68, 0, 0]

74
New cards

Which of the following best describes what this program does?

prints out the scores in reverse order stored in the array