Which code segment will print “Hello Karel” to the screen in Java?
Mid-Year Java Check

Quiz
•
Computers
•
8th Grade
•
Hard
Elisa Lovejoy
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
System.out.printLine("Hello Karel");
print "Hello Karel";
System.out.println("Hello Karel");
System.println("Hello Karel");
system.out.println("Hello Karel");
Answer explanation
System is a class, so it MUST ALWAYS start with an uppercase S.
A String MUST ALWAYS be encapsulated with double quotes [i.e., "This sentence is a string."]
2.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What will this code segment output?
System.out.println("Hello");
System.out.println("World");
Hello
World
HelloWorld
Hello World
hello
World
Answer explanation
The use of the println command forces a carriage return [like hitting the enter key], therefore the words will appear on a different line.
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which of the following is a proper way to declare and initialize a variable in Java?
myInteger = 100;
char = 'a';
int myNumber = 10;
"Variable"
Answer explanation
To declare a variable, you must first use the name for the variable type, then give the variable a name [for example]:
int age;
declares an integer variable type with the name of age
To store a value [initialize] into it the same time as you declare it would be as follows:
int age = 13;
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which of the below is not a primitive type in Java?
int
char
boolean
double
apple
Answer explanation
At best -- the word "Apple" would be a value stored in a String variable.
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Which of these input methods is not correct?
readInt
readDouble
readChar
readBoolean
readVariable
Answer explanation
All of the other answers would output a question [which you would write] and expect the proper value-type as a response from the user.
6.
MULTIPLE CHOICE QUESTION
1 min • 5 pts
What will this code segment output if the user inputs the number 10?
int yourInteger = readInt("Please input a number");
System.out.println(yourInteger);
yourInteger
“yourInteger”
10
“10”
Answer explanation
When you declare a variable and ask for userinput, then this is what is stored in that variable. Therefore, when the variable is output, the name of it doesn't appear, but rather the value you stored in it.
7.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the result of this expression?
150 % 100
0
100
50
3
Answer explanation
The % is the modulus operator [sometimes called mod]. It results in the REMAINDER of a division as the answer.
Create a free account and access millions of resources
Similar Resources on Quizizz
20 questions
Evaluación intermedia once

Quiz
•
1st - 11th Grade
20 questions
HTML Assignment

Quiz
•
8th Grade
21 questions
SAINS KOMPUTER TINGKATAN 4 (BAB1)

Quiz
•
KG - University
20 questions
quiz dasar python

Quiz
•
1st Grade - University
22 questions
DATA TYPES

Quiz
•
6th - 8th Grade
20 questions
Java String Quiz

Quiz
•
1st Grade - University
23 questions
HYKwCS CH09 S07 - JavaScript

Quiz
•
8th Grade
20 questions
prep2 lesson 1-2

Quiz
•
8th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University
44 questions
El fin del año- 7th

Quiz
•
7th - 12th Grade
40 questions
Word Study Assessment: Roots, Prefixes, Suffixes, and Vocabulary

Quiz
•
8th Grade
17 questions
guess the logo

Quiz
•
8th Grade
16 questions
Function or Non-Function?

Quiz
•
8th - 10th Grade
15 questions
Sentence Fragments and Run-ons

Quiz
•
8th Grade