Deck 1: Getting Started
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/46
Play
Full screen (f)
Deck 1: Getting Started
1
In Java,the equal sign is used as the ___________ operator.
(a)increment
(b)decrement
(c)assignment
(d)negation
(a)increment
(b)decrement
(c)assignment
(d)negation
C
2
Which operator returns the remainder of integer division?
(a)%
(b)/
(c)*
(d)none of the above
(a)%
(b)/
(c)*
(d)none of the above
A
3
Applets were designed to run as stand-alone applications.
False
4
What is the value of the variable amountDue?
Double price = 2.50;
Double quantity = 5;
Double amountDue = 0;
AmountDue = price * quantity;
(a)12
(b)12.25
(c)12.5
(d)13
Double price = 2.50;
Double quantity = 5;
Double amountDue = 0;
AmountDue = price * quantity;
(a)12
(b)12.25
(c)12.5
(d)13
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
5
The Java programming language allows you to concatenate two strings using the plus sign.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
6
Identify the invalid Java identifier.
(a)1Week
(b)Week1
(c)amountDue
(d)amount_due
(a)1Week
(b)Week1
(c)amountDue
(d)amount_due
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
7
In Java,source code is compiled into object code called ______________.
(a)Bit-code
(b)Class code
(c)Method code
(d)Byte-code
(a)Bit-code
(b)Class code
(c)Method code
(d)Byte-code
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
8
To mark a block comment for inclusion in the Javadoc documentation,the block must be delimited by:
(a)/** */
(b)*/* */
(c)**/ /*
(d)**/ */
(a)/** */
(b)*/* */
(c)**/ /*
(d)**/ */
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
9
Which operator is used to concatenate two strings?
(a)+
(b)-
(c)*
(d)/
(a)+
(b)-
(c)*
(d)/
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
10
What is the Java expression for 4a2 + 2b * c?
(a)(4 * a)+ (2 * b)* c
(b)(4 * a * a)+ ((2 * b)* c)
(c)((4 * a * a)+ (2 * b))* c
(d)(4 + a * a)+ ((2 + b)* c)
(a)(4 * a)+ (2 * b)* c
(b)(4 * a * a)+ ((2 * b)* c)
(c)((4 * a * a)+ (2 * b))* c
(d)(4 + a * a)+ ((2 + b)* c)
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
11
What is the value of the variable c in the statements that follow?
String phrase = "Make hay while the sun is shining.";
Char c = phrase.charAt(10);
(a)w
(b)h
(c)i
(d)None of the above
String phrase = "Make hay while the sun is shining.";
Char c = phrase.charAt(10);
(a)w
(b)h
(c)i
(d)None of the above
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
12
The hardest kind of error to detect in a computer program is a:
(a)Syntax error
(b)Run-time error
(c)Logic error
(d)All of the above
(a)Syntax error
(b)Run-time error
(c)Logic error
(d)All of the above
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
13
What is the Java expression for 27xy?
(a)27 + (x * y)
(b)27 * (x + y)
(c)27 * x * y
(d)27x * y
(a)27 + (x * y)
(b)27 * (x + y)
(c)27 * x * y
(d)27x * y
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
14
The escape sequence the represents the new-line character is:
(a)\r
(b)\t
(c)\n
(d)\\
(a)\r
(b)\t
(c)\n
(d)\\
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
15
In Java,a block comment is delimited by:
(a)*/ /*
(b)/* /*
(c)/* */
(d)*/ */
(a)*/ /*
(b)/* /*
(c)/* */
(d)*/ */
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
16
Java is an object-oriented programming language.An object-oriented language
(a)Uses structured programming.
(b)Views a program as consisting of objects which communicate through interactions.
(c)Functionally breaks down problems into smaller,more manageable problems.
(d)All of the above.
(a)Uses structured programming.
(b)Views a program as consisting of objects which communicate through interactions.
(c)Functionally breaks down problems into smaller,more manageable problems.
(d)All of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
17
The syntax that declares a Java named constant named SALES_TAX is:
(a)double SALES_TAX = 7.50;
(b)public double SALES_TAX = 7.50;
(c)public static double SALES_TAX = 7.50;
(d)public static final double SALES_TAX = 7.50;
(a)double SALES_TAX = 7.50;
(b)public double SALES_TAX = 7.50;
(c)public static double SALES_TAX = 7.50;
(d)public static final double SALES_TAX = 7.50;
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
18
The value of the expression (int)27.6 evaluates to:
(a)28
(b)27
(c)26
(d)None of the above.
(a)28
(b)27
(c)26
(d)None of the above.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
19
What is the value of 7.52e-5?
(a)752000.0
(b)0.0000752
(c)0.000752
(d)0.00752
(a)752000.0
(b)0.0000752
(c)0.000752
(d)0.00752
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
20
Java began as a language for home appliances.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
21
There are two kinds of Java programs,applications and applets.Define and discuss each.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
22
A variable of type boolean can be explicitly converted to that of type int.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
23
Objects of type String are strings of characters that are written within single quotes.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
24
How is the % (modulus)operator used? What is the common use of the modulus operator?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
25
What is byte-code? What is its importance?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
26
Explain the difference between an implicit type cast and an explicit type cast.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
27
An advantage of using the Unicode character set is that it easily handles languages other than English.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
28
What steps must the programmer take to create an executable Java program?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
29
What is the syntax and semantics of a programming language?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
30
Java uses the ASCII character set.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
31
In Java,Strings are immutable objects.Immutable objects can be changed.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
32
Define high-level languages,machine language and low-level language.Explain how the languages correspond to one another.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
33
Define the terms class,object,method and method call.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
34
Java is an interpreted language.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
35
List the primitive data types Java supports.Indicate the kind of values each type can store.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
36
The modulus operator,%,returns the remainder of integer division.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
37
Java does not require that a variable be declared before it is used within a program.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
38
The result of integer division is truncated in Java.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
39
What are the values of the variables a,b,c,and d after the execution of the following expressions?
Int a = 3;
Int b = 12;
Int c = 6;
Int d = 1;
D = d * a;
C = c + 2 * a;
D = d - b / c;
C = c * b % c;
B = b / 2;
Int a = 3;
Int b = 12;
Int c = 6;
Int d = 1;
D = d * a;
C = c + 2 * a;
D = d - b / c;
C = c * b % c;
B = b / 2;
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
40
What is the output produced by the following lines of code?
int value1 = 3;
int value2 = 4;
int result = 0;
result = value1++ * value2--;
System.out.println("Post increment/decrement: " + result);
result = ++value1 * --value2;
System.out.println("Pre increment/decrement: " + result);
int value1 = 3;
int value2 = 4;
int result = 0;
result = value1++ * value2--;
System.out.println("Post increment/decrement: " + result);
result = ++value1 * --value2;
System.out.println("Pre increment/decrement: " + result);
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
41
Why is using named constants a good programming practice?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
42
What does the String method trim()do? Give an example of its use.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
43
Write a Java statement to determine the length of a string variable called input.Store the result in an integer variable called strLength.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
44
Write a Java statement to access the 7th character in the String variable myString and place it in the char variable c.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
45
How are line comments and block comments used?
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
46
What is the output of the following Java statements?
//String method examples
String str = "Java Programming!";
System.out.println(str.equals("Java Programming!"));
System.out.println(str.toLowerCase());
System.out.println(str.toUpperCase());
System.out.println(str.substring(5,8));
System.out.println(str.lastIndexOf("m"));
//String method examples
String str = "Java Programming!";
System.out.println(str.equals("Java Programming!"));
System.out.println(str.toLowerCase());
System.out.println(str.toUpperCase());
System.out.println(str.substring(5,8));
System.out.println(str.lastIndexOf("m"));
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck