
Java Foundation_1
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Medium
Rukumani CT_PG
Used 7+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following program?
public class MathFunctions {
public static void addToInt(int x, int amountToAdd) {
x = x + amountToAdd;
}
public static void main(String[] args) { var a = 15;
var b = 10;
MathFunctions.addToInt(a, b); System.out.println(a); } }
10
15
25
Compile Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct signature of the main method in Java?
public static void main(String[] args)
public void main(String[] args)
private static void main(String[] args)
public static void main()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid way to declare an array in Java?
int[] arr = new int[5];
int arr[] = new int(5);
int arr = new int[5];
array int arr = new int[5];
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
String str = "Hello";
str.concat(" World");
System.out.println(str);
}
}
Hello
Hello World
Compile Error
Runtime Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet?
public class Example {
public static void main(String[] args) {
int x = 10;
if (x > 5) {
x += 5;
} else {
x -= 5;
}
System.out.println(x);
}
}
5
10
15
Compile Error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program? (Choose all that apply.)
interface HasTail { int getTailLength(); }
abstract class Puma implements HasTail {
protected int getTailLength() { return 4; } }
public class Cougar implements HasTail {
public static void main(String[] args) { var puma = new Puma();
System.out.println(puma.getTailLength());
}
public int getTailLength(int length) { return 2; } }
2
4
Code will not compile
Output cannot be determined
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
public class Example {
public static void main(String[] args) {
int a = 5;
int b = 10;
System.out.println(a + b);
}
}
5
10
15
Compile 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?
Similar Resources on Wayground
20 questions
SOFTWARE 7I
Quiz
•
7th Grade - University
10 questions
Diplo Alternativas
Quiz
•
1st - 3rd Grade
20 questions
Algoritma Remedial RPL
Quiz
•
University
10 questions
Quiz - CSE
Quiz
•
University
17 questions
Aplicaciones Web
Quiz
•
12th Grade
15 questions
GK Quiz
Quiz
•
University
10 questions
10 câu kiểu xâu tiết 1
Quiz
•
11th Grade
13 questions
LENGUAJE C
Quiz
•
11th Grade
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
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
