ISQS 3345 Test 1
When determining whether a number is inside a range, its best to use this operator. o && o ! o || o ? :
&&
How does the character 'A' compare to the character 'B'? o 'A' is greater than 'B' o 'A' is less than 'B' o 'A' is equal to 'B' o You cannot compare characters
'A' is less than 'B'
These characters mark the beginning of a multi-line comment. o // o /* o */ o /**
/*
These characters mark the beginning of a documentation comment. o // o /* o */ o /**
/**
These characters mark the beginning of a single-line comment. o // o /* o */ o /**
//
What will the println statement in the following program segment display? Int x = 5; System.out.println(x++); o 5 o 6 o 0 o none of these
5
What will the println statement in the following program segment display? Int x = 5; System.out.println(++x); o 5 o 6 o 0 o none of these
6
Which of the following are NOT valid assignment statements? o Total = 9; o 72 = amount; o profit = 129 o letter = 'W';
72 = amount; profit = 129
This type of expression has a value of either true or false. o Binary expression o Decision expression o Unconditional expression o Boolean expression
Boolean expression
A group of statements, such as the contents of a class or a method, are enclosed in _____. o Braces { } o Parentheses ( ) o Brackets [ ] o Any of these will do
Braces { }
To create a block of statements, you enclose the statement in these. o Parentheses ( ) o Square brackets [ ] o Angled brackets < > o Braces { }
Braces { }
The Java compiler generates. o Machine code o Byte code o Source code o HTML
Byte code
This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place. o Cast o Binary o Uploading o Dot
Cast
The if statement is an example of a _____. o Sequence structure o Decision structure o Pathway structure o Class structure
Decision Structure
This section of a switch statement is branched to if none of the case expressions match the switch expression. o Else o Default o Case o Otherwise
Default
Boolean variables may hold values 0 or 1.
F
When passing multiple arguments to a method, the order in which the arguments are passed is not important
F
When you write a constructor for a class, it still has the default constructor that Java automatically provides
F
Comments that begin with // can be processed by javadoc. o True o False
False
If one of an operators operands is a double, and the other operand is an int, Java will automatically convert the value of the double to an int. o True o False
False
The = operator and the == operator perform the same operation. o True o False
False
Variable names may begin with a number. o True o False
False
When an if statement is nested in the else clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true. o True o False
False
This is a Boolean variable that signals when some condition exists in the program. o Flag o Signal o Sentinel o Siren
Flag
You can use this class to display dialog boxes. o JOptionPane o BufferedReader o InputStreamReader o DialogBox
JOptionPane
These are words that have a special meaning in the programming language. o Punctuation o Programmer-defined names o Key words o Operators
Key words
The following data 72 , 'A' , "Hello World" , 2.8712 are all examples of ______. o Variables o Literals o Strings o None of these
Literals
&& , || , and ! are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators
Logical operators
This is an if statement that appears inside another if statement. o Nested if statement o Tiered if statement o Dislodged if statement o Structured if statement
Nested if statement
This is an empty statement that does nothing. o Missing statement o Virtual statement o Null statement o Conditional statement
Null statement
These are symbols or words that perform operations on one or more operands. o Punctuation o Programmer-defined names o Key words o Operators
Operators
In the expression number++, the ++ operator is in what mode? o Prefix o Protest o Postfix o Posttest
Postfix
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. o Punctuation o Programmer-defined names o Key words o Operators
Programmer-defined names
These characters serve specific purposes, such as marking the beginning or ending of a statement, or separating items in a list. o Punctuation o Programmer-defined names o Key words o Operators
Punctuation
> , < , and == are _____. o Relational operators o Logical operators o Conditional operators o Ternary operators
Relational operators
Every complete statement ends with a ____. o Period o Parenthesis o Semicolon o Ending brace
Semicolon
These are the rules that must be followed when writing a program. o Syntax o Punctuation o Key words o Operators
Syntax
You can use this method to display formatted output in a console window. o Format.out.println o Console.format o System.out.printf o System.out.formatted
System.out.printf
Which of the following are not valid println statements? o System.out.println + "Hello World"; o System.out.println("Have a nice day"); o Out.System.println(value); o Println.out(Programming is great fun);
System.out.println + "Hello World"; Out.System.println(value); Println.out(Programming is great fun);
Each instance of a class has its own set of instance fields.
T
You cannot change the value of a variable whose declaration uses the final key word.
T
An else clause always goes with _____. o The closest previous if clause that doesn't already have its own else clause o The closest if clause o The if clause that is randomly selected by the compiler o None of these
The closest previous if clause that doesn't already have its own else clause
This determines whether two different String objects contain the same string. o The == operator o The = operator o The equals method o The StringCompare method
The equals method
The conditional operator takes this many operands. o One o Two o Three o Four
Three
A conditionally executed block should be indented one level from the if clause. o True o False
True
A left brace in a Java program is always followed by a right brace later in the program. o True o False
True
A variable must be declared before it can be used. o True o False
True
All lines in a conditionally executed block should be indented one level. o True o False
True
The occurrence of a string literal in a Java program causes a String object to be created in memory, initialized with the string literal
True
The scope of a variable is limited to the block in which it is defined. o True o False
True
When an if statement is nested in the if clause of another statement, the only time the inner if statement is executed is when the Boolean expression of the outer if statement is true. o True o False
True
When passing an argument to a method, the argument's data type must be compatible with the parameter variable's data type.
True
You cannot change the value of a variable whose declaration uses the final key word. o True o False
True
The negation operator is _____. o Unary o Binary o Ternary o None of these
Unary
This is a named storage location in the computers memory. o Class o Key word o Variable o Operator
Variables
When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) _____. o 4-Bit conversion o Escalating conversion o Widening conversion o Narrowing conversion
Widening conversion
Which of the following is the logical AND operator? a. && b. || c. == d. &
a. &&
This is the software used to create Java programs. a. Java Development Kit b. Java compiler c. Java Virtual Method d. Java Virtual Machine
a. Java Development Kit
Which of the following is not a primitive data type? a. String b. int c. float d. boolean
a. String
This is a method that gets a value from a class's field, but does not change it. a. accessor b. constructor c. void d. mutator
a. accessor
Each byte is assigned a unique a. address b. CPU c. bit d. variable
a. address
A class is analogous to a a. blueprint b. house c. architect d. attribute
a. blueprint
When a local variable has the same name as a field, the local variable's name does this to the field's name. a. shadows b. complements c. deletes d. merges with
a. shadows
Which of the following escape sequences represents backspace? a. \\ b. \b c. \n d. \r
b. \b
If you were to look at a machine language program, you would see _________. a. Java source code b. a stream of binary numbers c. English words d. circuits
b. a stream of binary numbers
This section of a switch statement is branched to if none of the case values match the testExpression. a. else b. default c. case d. otherwise
b. default
When this access specifier is applied to a class member, the member cannot be accessed by code outside the class. What is this access specifier? a. public b. private c. void d. protected
b. private
This key word causes a value to be sent back from a method to the statement that called it. a. send b. return c. value d. public
b. return
When the value of an item is dependent on other data, and that item is not updated when the other data is changed, what has the value become? a. bitter b. stale c. asynchronous d. moldy
b. stale
UML stands for a. Universal Modeling Language b. Unified Model Language c. Unified Modeling Language d. Unicode Modelling Language
c. Unified Modeling Language
If you do not write a constructor for a class, this is automatically provided for the class. a. accessor method b. default instance c. default constructor d. predefined constructor
c. default constructor
In OOP, this refers to the combining of data and code into a single object. a. data hiding b. inheritance c. encapsulation d. polymorphism
c. encapsulation
This is a member of a class that holds data. a. method b. instance c. field d. constructor
c. field
These are words or names defined by the programmer. a. classes b. key words c. identifiers d. operators
c. identifiers
Which of the following is an access specifier? a. javac b. class c. public d. void
c. public
An object is a(n) a. blueprint b. attribute c. variable d. instance
d. instance
This is a method that stores a value in a field or in some other way changes the value of a field. a. accessor b. constructor c. void d. mutator
d. mutator
To find the classes needed for an object-oriented application, you identify all of the verbs in a description of the problem domain
f
This key word is used to declare a named constant. o constant o namedConstant o final o concrete
namedConstant
Which Scanner class method would you use to read a double as input? o nextDouble o getDouble o readDouble o None of these; you cannot read a double with Scanner class
nextDouble
Which Scanner class method would you use to read a string as input? o nextString o nextLine o readString o getLine
nextLine
All relational operators are binary operators.
t
Switch statement only check for equality.
t