stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Final Java Flashcards | StudBud
Explore
/
Final Java
Final Java
49 terms
·
StudBud Administration
·
51 plays
Introduction to Java chapter 6 review
Flashcards
49 cards
F
Practice quiz
P
Host live
L
Questions
49
Answers
1
Which keyword is used to declare a constant in Java?
D. constant
B. static
const
C. final
2
Java Arrays are . . .
objects that don't store multiple variables 😇
objects that can only store 2 variables of the same type 😇
objects that do not store any variables of the same type 😇
objects that store multiple variables of the same type 😇
3
System.out.print("Java rocks!".substring(2,6) );
va ro
ava r
va r
ava
4
Valid Variable names
total.mark
total_mark
total-mark
total_
5
What is Java Methods?
Data and parameters.
A method is a block of code which only runs when it is called.
Class.
A method is a block of code which only runs when it is created.
6
What is the keyword for arrays in Java
[]
[T/type]
Array
array
7
Which of the following ALWAYS comes before multiplication in Java's order of operations?
Division
Any addition to the left of it
Any division to the left of it
Any modulus
8
Java "methods" are like
proper nouns
categories
adverbs
verbs
9
What's the output? String result = "Java Programming".substring(5, 10);
a Pro
Progr
Progra
Program
10
Which type of error is detected during compilation because of mispellings?
B. Syntax error
A. Runtime error
D. Semantic error
C. Logic error
11
Loop is used when value runs from known starting point to ending point w/constant inc/decrement
goto
do
for
while
12
A loop that runs forever & can be stopped only by killing the program/restarting the computer:
nested loop
infinite loop
run-on loop
terminal loop
13
Select valid variable names
cupcake1
cupcake%
cup cake
cupcake!
14
How many times will this loop run?
10
8
9
0
15
How many times does the loop execute in the following code fragment?
11
12
13
14
16
Which of the following best describes string concatenation in Java
Two variables / fields combined.
The combining of two different java functions
The combining of two different ints to create a new int
Two different strings combined to create a new string.
17
Which of the following correctly uses a one-way if statement?
D. if (x > 0) System.out.println(x)
A. if x > 0 System.out.println(x); System.out.println(x); }
C. if (x > 0);
B. if (x > 0) {
18
Which of the following syntax is correct for Arrays creation in java:
int [] arr;
int [] arr= new arr[];
int Array = new int[];
int [] arr = new int[];
19
If your goal is to find a match, write your program code to exit the loop when:
all entries have been tested
when the end of file is reached
when the match is found
whenever the user decides to quit
20
Which of the following methods is used to compare two String objects in Java?
compareTo()
isEqual()
compare()
equals()
21
"java".substring(2)
will return...
a
ava
v
va
22
Which of the following is a mathematical operator in Java?
$
/
#
!
23
A valid Java primitive data type.
String
character
integer
byte
24
Select the statement that correctly completes the loop in this code snippet:
balance--;
years--;
years++;
balance++;
25
The condition in a loop or if statement must evaluate to what type value?
decimal number
String
Boolean
whole number
26
What are the 3 Java Logical Operators?
and, or , not
&&, ||, !
and, or , not equal
&, |, !
27
. What is the result of the expression 3 + 4 * 2?
10
7
11
14
28
methods in java
are very basic, do not support parameters
can start with a number
have a return type
are all dynamic
29
What will System.out.println("Java".substring(1,3)); print?
Jav
av
va
ava
30
Where are all Java methods defined?
at the end of the file
in a .h file
within a class
within a package but in a separate file
31
What is the string concatenation symbol in Java?
-
+
"
'
32
Java methods can be overriden
False
True
33
Which of the following expression results in a value 2?
15%5
5%5
7%5
13%5
34
If you declare an array double[] list = {3.4, 2.0, 3.5, 5.5}, the highest index in array list is __________.
1
None of the above
3
0
35
What is boolean in Java?
A value consisting of 8 values
All of these
A value consisting of only true and false value
Truthy value in java
36
To increase(increment) a variable by 2 in a FOR loop header, what statement would be used?
for (int i=0; i <=5, i++)
for (int i=0; i <= 5; i = i + 2)
for (int i=0; i<=5; i+i)
for (int i=0; i <= 5, i= i * i)
37
What keyword introduced in Java allows returning a value from a switch expression?
B. return
break
C. exit
D. yield
38
A _______ loop (body of loop contains another loop) is used to print table rows and columns:
Advanced
Adjacent
Concurrent
Nested
39
To what value should the variable done be set to terminate this loop?
false
stop
true
start
40
If the boolean variable DONE is used to start the loop, what value is needed to stop the loop?
true
done
false
stop
41
In Java, methods have ________
public, static, type, name, variables
public, static, type, name, parameters
public, void, type, name, parameters
public, static, type, int, parameters
42
A loop executes instructions repeatedly while a condition is ___________.
unknown
random
true
false
43
In Java, which of the following methods is used to convert a string to uppercase?
stringToUpper()
toUpper()
toUpperCase()
upperCase()
44
Java follows correct mathematical precedence (Order of Operations)
False
True
45
An object is an blueprint created from a __________.
class
method
data
program
46
Which of the following loops prints "Welcome to Java" 10 times?
B
D
C
A
47
What is evaluated first in Java order of operations?
-
( )
%
+
48
In java the syntax for declaring a variable is
True
False
49
What are the three loops in Java?
ElseIf, Do While, When
Do - For; If - Else; While
While, For, Do
Do-While, Do-When, Do-Until