stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java (Applets, Boolean, Strings, Loops, and More) Flashcards | StudBud
Explore
/
Java (Applets, Boolean, Strings, Loops, and More)
Java (Applets, Boolean, Strings, Loops, and More)
20 terms
·
StudBud Administration
·
134 plays
#Java #Coding #Programming #Basics #Loops #Applets #Boolean #Strings #Computer #CP1 #Review
Flashcards
20 cards
F
Practice quiz
P
Host live
L
Questions
20
Answers
1
What is the value stored in the true_false variable: boolean true_false = !(!(!(!(!false))));
error
false
!(!(!(!(!false))));
true
2
Of the following statements, which one executes two instructions if the condition is true?
{ if (x < 0) a = c* 5; c=b; }
if { (x < 0) a = c* 5; c=b; }
if (x < 0) { a = c* 5; c=b; }
if (x < 0) a = c* 5; c= b;
3
In a String, which of the following can determine if the first and last character are the same?
(s.charAt(0) == s.charAt(s.length()))
(s.charAt(0) == s.charAt(s.length() - 1))
(s.charAt(0) == s.charAt(s.length() + 1))
(s.charAt(1) == s.charAt(s.length()))
4
Suppose you have the following code. What is the value of p and q?
p = 21, q = 15
p = 4, q = 15
p = 20, q = 16
p = 19, q =16
5
What is the library that is standard in all IDEs so we don't have to import it?
Java.util.Scanner
Java.awt
Java.lang
Javax.swing.JOptionPane
6
What is the purpose of the default case in a switch statement?
It is a different name for the first option in the switch.
It serves no purpose and doesn't exist. Nice try Mrs. Ouda!
It is used when the input does not match any other case.
I have no idea.
7
if x is currently 1, a = 8, b = 3, what will x become after the above statement is executed?
2
19
14
9
8
What is the import statement for applets?
java.applet.Applet
java.awt.*
java.applet.*
Java.awt.Applet
9
What is the output if x = 12 ?
error, because 12 meets multiple condition statements
"the number 12 is a multiple of 3"
"the number 12 is even"
"the number 12 is odd"
10
What is the difference between a Java application and an Applet
One is for computers and the other is for a phone.
Applications can be tested in eclipse, Applets cannot.
Applications are standalone. Applets run in browsers.
Applications need to be exported to run. Applets do not.
11
What will the output of the following code be?
"January"
"monthString"
"March"
"February"
12
What is the library package needed in order for the Graphics class to be recognized by Java?
Javax.swing.JOptionPane
Java.lang
Java.util.Scanner
Java.awt
13
Now suppose you have this. What is the value of p and q?
p = 16, q = 5
p = 15, q = 6
p = 16, q = 6
p = 15 q = 5
14
What will be the value of x after this code is executed?
22
2
4
16
15
How many inputs does the drawRect(); method take?
3
4
1
2
16
What is output by the following code?
"Apples and bana"
"nanas"
"Apples and ba"
"anas"
17
What value is stored in the boolean variable true_false?
True
False
18
What is the string method that checks if two strings are the same?
string.compare()
string.fourthAnswer()
string.indexOf()
string.equals()
19
What is the output of "apple.length();" if apple = "Apple Pie Friday!";
17
14
16
15
20
How many times will the loop execute?
6
4
5
0