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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/45
Play
Full screen (f)
Deck 1: Getting Started
1
Java began as a language for home appliances.
True
2
The Java programming language allows you to concatenate two strings using the plus sign.
True
3
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;
D
4
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 45 flashcards in this deck.
Unlock Deck
k this deck
5
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 45 flashcards in this deck.
Unlock Deck
k this deck
6
Java is an interpreted language.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
7
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 45 flashcards in this deck.
Unlock Deck
k this deck
8
In Java,a block comment is delimited by:
A)*/ /*
B)/* /*
C)/* */
D)*/ */
A)*/ /*
B)/* /*
C)/* */
D)*/ */
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
9
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 45 flashcards in this deck.
Unlock Deck
k this deck
10
Which operator is used to concatenate two strings?
A)+
B)-
C)*
D)/
A)+
B)-
C)*
D)/
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
11
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 45 flashcards in this deck.
Unlock Deck
k this deck
12
Which operator returns the remainder of integer division?
A)%
B)/
C)*
D)none of the above
A)%
B)/
C)*
D)none of the above
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
13
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 45 flashcards in this deck.
Unlock Deck
k this deck
14
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 45 flashcards in this deck.
Unlock Deck
k this deck
15
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 45 flashcards in this deck.
Unlock Deck
k this deck
16
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 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 45 flashcards in this deck.
Unlock Deck
k this deck
17
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
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
18
Applets were designed to run as stand-alone applications.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
19
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.charAt10);
A)w
B)h
C)i
D)None of the above
Char c = phrase.charAt10);
A)w
B)h
C)i
D)None of the above
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
20
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 45 flashcards in this deck.
Unlock Deck
k this deck
21
What is the syntax and semantics of a programming language?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
22
List the primitive data types Java supports.Indicate the kind of values each type can store.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
23
Java does not require that a variable be declared before it is used within a program.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
24
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 45 flashcards in this deck.
Unlock Deck
k this deck
25
Explain the difference between an implicit type cast and an explicit type cast.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
26
Two kinds of Java programs are applications and applets.Define and discuss each.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
27
The result of integer division is truncated in Java.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
28
A variable of type boolean can be explicitly converted to that of type int.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
29
An advantage of using the Unicode character set is that it easily handles languages other than English.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
30
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 45 flashcards in this deck.
Unlock Deck
k this deck
31
What does the String method trim)do? Give an example of its use.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
32
Objects of type String are strings of characters that are written within single quotes.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
33
Java uses the ASCII character set.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
34
The modulus operator,%,returns the remainder of integer division.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
35
In Java,Strings are immutable objects.Immutable objects can be changed.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
36
What is byte-code? What is its importance?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
37
Define the terms class,object,method and method call.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
38
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 45 flashcards in this deck.
Unlock Deck
k this deck
39
How is the % modulus)operator used? What is the common use of the modulus operator?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
40
What steps must the programmer take to create an executable Java program?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
41
Write a Java statement to access the 7< sup >th< /sup > character in the String variable myString and place it in the char variable c.
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
42
Why is using named constants a good programming practice?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
43
How are line comments and block comments used?
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck
44
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 45 flashcards in this deck.
Unlock Deck
k this deck
45
What is the output of the following Java statements?
//String method examples
String str = "Java Programming!";
System.out.printlnstr.equals"Java Programming!"));
System.out.printlnstr.toLowerCase));
System.out.printlnstr.toUpperCase));
System.out.printlnstr.substring5,8));
System.out.printlnstr.lastIndexOf"m"));
//String method examples
String str = "Java Programming!";
System.out.printlnstr.equals"Java Programming!"));
System.out.printlnstr.toLowerCase));
System.out.printlnstr.toUpperCase));
System.out.printlnstr.substring5,8));
System.out.printlnstr.lastIndexOf"m"));
Unlock Deck
Unlock for access to all 45 flashcards in this deck.
Unlock Deck
k this deck