Midterm

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/151

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

152 Terms

1
New cards
Logical errors are mistakes that cause the program to produce erroneous results.
True
2
New cards
Application software refers to programs that make the computer useful to the user
True
3
New cards
Java files end with the .class extension
False
4
New cards
A procedure is a set of programming language statements that, together, perform a specific task.
True
5
New cards
Without programmers, the users of computers would have no software, and without software, computers would not be able to do anything.
True
6
New cards
The contents of a variable cannot be changed while the program is running.
False
7
New cards
RAM is usually\______
A volatile types of memory, used for temporary storage
8
New cards
The two primary methods of programming in use today are\_____
Procedural and Object oriented
9
New cards
Software refers to \____
programs
10
New cards
Variables are
Symbolic names made up by the programmer that represents locations in the computer's RAM
11
New cards
\_____ refers to the physical components that a computer is made of
Hardware
12
New cards
A cross between human language and programming language is called \_____
Pseudocode
13
New cards
Key words are\____
Words that have a special meaning in the programming language
14
New cards
Application software refers to \_____
programs that make the computer useful to the user
15
New cards
What is a syntax?
Rules that must be followed when writing a program
16
New cards
The CPU (Central Processing Unit) consists of two parts which are \_____
The Control Unit and the Logic Unit
17
New cards
There are \____ bits in a byte
8
18
New cards
Java was developed by \_____
Sun Microsystems
19
New cards
Which of the following will compile a program called ReadIt

java ReadIt.javac
javac ReadIt.javac
javac ReadIt.java
java ReadIt.java
javac ReadIt.java
20
New cards
Which of the following will run the compiled program called ReadIt

run ReadIt
java ReadIt
go ReadIt
java ReadIt.java
java ReadIt
21
New cards
Both characters and string literals can be assigned to a char variable
false
22
New cards
A variable's scope is the part of the program that has access to the variable.
True
23
New cards
Named constants are initialized with a value, that value cannot be changed during the execution of the program.
True
24
New cards
The Java API provides a class method named Math that contains numerous methods which are useful for performing complex mathematical operations
True
25
New cards
Java is not case sensitive.
False
26
New cards
A program must have at least one of the following
A class definition
27
New cards
Which of the following would contain the translated java byte code for a program named Demo

Demo.byte
Demo.java
Demo.code
Demo.class
Demo.class
28
New cards
Which of the following is a named storage location in the computers memory

a literal
a variable
a constant
an operator
A variable
29
New cards
To compile a program named First you would use which of the following commands?

compile First.java
javac First.java
java First.java
javac First
javac First.java
30
New cards
Which of the following is not a rule that must be followed when naming identifiers

The 1st character must be one of the letters A/a-Z/z, underscore, or a $
Identifiers can contain spaces
Upper/lowercase characters are distinct
After the 1st character, you can use the letters A/a-Z/z, underscore, 0-9, or a $
Identifiers can contain spaces
31
New cards
Characters literals are enclosed in \____ and string literals are enclosed in \_____
single quotes and double quotes
32
New cards
What is the result of the following expression
17 % 3 * 2 - 12 + 15
7
33
New cards
What is the value of z after the following statements have been executed?
int x \= 4, y \= 33;
double z;
z \= (double) (y / x);
8.0
34
New cards
Which of the following statements is invalid

double r \= 2.9X106
double r \= 9.4632E15
double r \= 326.75
double r \= 9.4632e15
double r \= 2.9X106
35
New cards
What will be displayed as a result of executing the following code?

Final int \= 22, y \= 4;
y +\= x;
System.out.println("x \= " + x + ", y \= " + y)
Nothing, there is an error in the code
36
New cards
Which of the following correctly creates a Scanner object for keyboard input

Scanner keyboard \= new Scanner(System.in);
Keyboard scanner \= new Keyboard(System.in);
Scanner kbd \= new Scanner(System.keyboard);
Scanner keyboard(System.in);
Scanner keyboard \= new Scnnaer(System.in);
37
New cards
The primitive data types only allow a(n) \________ to hold a single value.
Variable
38
New cards
When the + operator is used with strings, it is known as the
string concatenation operator
39
New cards
What would be printed out as a result of the following code?

System.out.println ("the quick brown fox" + "jumped over the \n" "slow moving hen.");
Nothing, there is an error
40
New cards
Which of the following is valid?

float y;
double z;
z \= 934.21;
y \= z;

float w;
w \= 1.0f;

float y;
y \= 54.9;

float v;
v \= 1.0
float w;
w \= 1.0f;
41
New cards
In an if-else statement, if the boolean expression is false then
The statement or block following the else is executed
42
New cards
\______ operators are used to determine whether a specific relationship exists between two values
relational
43
New cards
If str1 and str2 are both String object, which of the following expressions will correctly determine whether or not they are equal

str1 +\= str2

str1 \= str2

str1.equals(str2)

str1 && str2
str1.equals(str2)
44
New cards
A block of code in enclosed in a set of
braces
45
New cards
A flag may have the values
True or False
46
New cards
What will the values of ans ,x, and y be after the following statements are executed

int ans\=35, x \= 50, y \= 50;
if (X\>\=Y)
{
ans \= x + 10;
x -\= y;
}
else
{
ans \= y + 10;
y +\= x;
}
ans \= 60, x \= 0, y \= 50
47
New cards
What will the value of x be after the following statements are executed

int x \= 75;
int y \= 60;
if (x\>y)
x \= x-y
15
48
New cards
What will the value of x be after the following statements execute?

int x \= 10;
switch (x)
{
case 10:
x +\= 15;
case 12:
x -\= 5;
break;
default:
x +\= 3
20
49
New cards
Which of the following determines whether the char variable, CharA, is not equal to the letter 'A'

chrA !\= 'A'

chrA\== 'A'

chrA.notEquals(A)

chrA || 'A'
chrA !\= 'A'
50
New cards
In Java, when a character is stored in memory, it is actually the \______ that is stored
unicode
51
New cards
Java requires that the boolean expression being tested by an if statement be enclosed in \______
A set of parentheses
52
New cards
Which of the following statements determines whether the variable temp is within the range of 0-100 (inclusive)

if (temp \> 0 || temp < 100)

if (temp \> 0 && temp < 100)

if (temp \>\= 0 && temp \=< 100)

if (temp \>\= 0 || temp \=< 100)
if (temp \>\= 0 && temp \=< 100)
53
New cards
\________ works like this, If the expression on the left side of the && operator is false, the expression on the right side will not be checked
Short-circuit evaluation
54
New cards
What will be printed when the following code is executed?
double x \= 45678.259;
System.out.printf("%, .2f", x);
45,678.26
55
New cards
All it takes for an OR expression to be true is for one of the subexpressions to be true.
True
56
New cards
When testing for character values, the Switch statement does not test for the case of the character
False
57
New cards
Unicode is an international encoding system that is extensive enough to represent all the characters of all the world's alphabets.
True
58
New cards
A local variables scope always ends at the closing brace of the block of code in which it is declared
True
59
New cards
In a switch statement, each of the case values must be unique
True
60
New cards
The system.out.printf method formats a string and displays it in the console window
True
61
New cards
Which part of the computer fetches instructions, carries out the operations commanded by the instructions, and produces some outcome or resultant information?
CPU
62
New cards
A byte is made up of eight
bits
63
New cards
Each byte is assigned a unique
address
64
New cards
This type of memory can hold data for long periods of time—even when there is no power to the computer.
Secondary Storage
65
New cards
If you were to look at a machine language program, you would see .
a stream of binary numbers
66
New cards
These are words that have a special meaning in the programming language.
key words
67
New cards
These are symbols or words that perform operations on one or more operands.
Operators
68
New cards
These characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list.
punctuation
69
New cards
These are words or names that are used to identify storage locations in memory and parts of the program that are created by the programmer.
Programmer defined names
70
New cards
These are the rules that must be followed when writing a program.
Syntax
71
New cards
The named storage location in the computer memory
Variable
72
New cards
The java compiler generates
byte code
73
New cards
JVM stands for
Java Virtual Machine
74
New cards
Every complete statement ends with a
semicolon
75
New cards
The following data are examples of what

72
'A'
"Hello World"
2.8712
literals
76
New cards
A group of statements, such as the contents of a class or a method, are enclosed in
Braces
77
New cards
Which of the following are not valid assignment statements? (Indicate all that apply.)
total \= 9;
72 \= amount;
profit \= 129
letter \= 'W';
72 \= amount, numbers cannot be first
78
New cards
Which of the following are not valid println statements? (Indicate all that apply.)

System.out.println + "Hello World";

System.out.println("Have a nice day");

out.System.println(value);

println.out(Programming is great fun);
1,3,4
79
New cards
the negation operator is
unary
80
New cards
This keyword is used to declare a named constant
final
81
New cards
These character mark the beginning of a multiline comment
/*
82
New cards
These character mark the beginning of a single line comment
//
83
New cards
These character mark the beginning of a documentation comment
/**
84
New cards
Which Scanner class method would you use to read a string as input?
nextLine
85
New cards
Which Scanner class method would you use to read a double as input?
nextDouble
86
New cards
You can use this class to display dialog boxes.
JOptionPane
87
New cards
When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) .
widening conversion
88
New cards
This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place.
cast
89
New cards
A left brace in a Java program is always followed by a right brace later in the program.
True
90
New cards
A variable must be declared before it can be used.
True
91
New cards
Variable names may begin with a number.
False
92
New cards
Comments that begin with // can be processed by javadoc.
False
93
New cards
If one of an operator's operands is a double, and the other operand is an int, Java will automatically convert the value of the double to an int.
false
94
New cards
What will the println statement in the following program segment display?

int x \= 5; System.out.println(x++);
5
95
New cards
What will the println statement in the following program segment display?

int x \= 5; System.out.println(++x);
6
96
New cards
In the expression number++, the ++ operator is in what mode?
postfix
97
New cards
What is each repetition of a loop known as?
iteration
98
New cards
This is a variable that controls the number of iterations performed by a loop.
loop control variable
99
New cards
The while loop is this type of loop.
pretest
100
New cards
The do-while loop is this type of loop.
posttest