Methods in Java
Quiz
•
Computers
•
11th - 12th Grade
•
Medium
Thomas Martinez
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A(n) ____ causes a value to be sent from a called method back to the calling method
method statement
return statement
initialization
assignment
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following could be the last legally coded line of a method declared as
public static int getVal(double sum)?
return;
return 77;
return 2.3;
Any of these could be the last coded line of the method
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following two methods:
public int profit(int x, int y) {
return x + y;
}
public int appeals(int x, int y) {
return x * y;
}
What would the value of z be if the following equation were implemented?
int z = appeals(6, profit(9, 7));
63
44
96
75
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following methods can be terminated by an empty return statement?
I. public static void func1()
II. public static int func1()
III. public static String func1()
I only
II only
III only
I and II
II and III
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What is the final output of the code segment below?
public class Sample {
public static void main(String[] args) {
int x = 5;
x = mystery(x + 1);
11
System.out.println(x);
}
public static int mystery(int x) {
int s = 0;
for (int I =1;i<x-1;i++){
s=s+x;
}
return s;
}}
12
10
24
28
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What does this program print?
public static int mystery(int x)
{
int y = x * x;
return y;
}
public static void main(String[] args) {
int a = 4;
System.out.println(mystery(a + 1));
}
20
12
22
25
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about a void method?
I. The method returns a boolean value
II. The method does not return any value
III. The method has a void return type
I only
II only
III only
I and II only
II and III only
Create a free account and access millions of resources
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
10 questions
Recursion Practice, Recursion Practice, Recursion Practice...
Quiz
•
10th Grade - University
11 questions
BTEC DIT C3 B1 - Threats to Data
Quiz
•
11th Grade
15 questions
AP Computer Science Principles - Module 3 Review
Quiz
•
10th - 12th Grade
13 questions
JavaScript Variables
Quiz
•
3rd Grade - University
14 questions
LA6.C6: Graphics Window
Quiz
•
9th Grade - University
12 questions
C++. Классы
Quiz
•
11th Grade
10 questions
Latihan Class Library
Quiz
•
9th - 12th Grade
15 questions
Adobe Digital Design 1.00 (Part 1)
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
