
Java Programming Quiz
Authored by Alisher Saimassay
Computers
KG
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
65 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax for initializing a variable named dog, of type String, with the value "BARK"?
string dog = "BARK";
dog = "BARK";
"BARK" = String dog;
int dog = "BARK";
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Look at the following line of code: int[] myList = { 1, 2, 3, 4, 5 }; What is the proper way to access the array element with the value 3?
myList["two"];
MyList[2];
myList[3];
myList.3
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Look at the following code: int i = 4; if (i <= 3) { i = 0; } else if (i <= 6) { i = 1; } else { i = 2; } What value would i be after this if then else statement?
null
1
2
0
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Look at the following function: public String reverseName( String name1, String name2 ) { String reversed = name2 + ", " + name1; return reversed; } Which is the proper way to call this function?
reverseName()
reverseName( "John", "Doe" )
reverseName("John",100)
ReverseName("John","Doe");
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Look at the following code: public class TestClass { // section 1: private String testName; // section 2: public TestClass( String name, int i ) { this.testName = name; } // section 3: public void countToThree() { for (int m = 1; m <= 3; m++) { System.out.println( "Count is: " + m ); } } } What is defined in the denoted sections of this class?
section 1: member variable section 2: constructor section 3: class method
section 1: method section 2: constructor section 3: member variable
Section 1: member variable. Section 2: constructor. Section 3: method.
section 1: member variable section 2: class method section 3: method
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
As an established Java convention, what would it mean if the name of a variable was spelled in all uppercase?
The variable is a constant, whose value should not change.
the variable is contains a string that has all capital letters
the variable is reserved for use by the Java environment, and you should not refer to it
nothing. There is no such convention, and such a variable is like any other
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Look at the following code: int errorInteger = 200; String comment; switch (errorInteger) { case 150: comment = "Javascript error."; break; case 240: comment = "Comment error."; break; case 300: comment = "Function error."; break; case 200: comment = "New error."; break; default: comment = "No error."; break; } System.out.println( comment ); What would be the resulting output from this code?
javascript error
comment error
function error
New error.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
4 questions
Conflict Resolution
Lesson
•
KG
20 questions
Place Value
Quiz
•
KG - 3rd Grade
20 questions
CVC Words
Quiz
•
KG - 1st Grade
24 questions
CKLA Unit 5 assessment K
Quiz
•
KG
10 questions
STAAR Review - Editing & Revising Clusters
Quiz
•
KG
10 questions
Reflexive Pronouns
Quiz
•
KG - 5th Grade
10 questions
Long i- igh, ie, and y Quiz
Quiz
•
KG - 3rd Grade
12 questions
Quarter Past, Half Past, and Quarter To
Quiz
•
KG - 12th Grade