
Methods in java

Quiz
•
Computers
•
11th - 12th Grade
•
Hard
Samar Sharkh
Used 14+ times
FREE Resource
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
Similar Resources on Wayground
10 questions
unit 3 practice question set 8

Quiz
•
9th - 12th Grade
10 questions
Programming basics

Quiz
•
9th - 12th Grade
15 questions
Topic 3 & 4 Practice - ArrayList and String Methods

Quiz
•
12th Grade
13 questions
Week 8

Quiz
•
12th Grade
10 questions
GDScript Quiz - Lesson 2 - Variables & Functions

Quiz
•
12th Grade
9 questions
quis lat soal

Quiz
•
9th - 12th Grade
10 questions
AP CSA Unit 1 & 2 Review

Quiz
•
9th - 12th Grade
15 questions
Pemrograman Berorientasi Objek PAS Ganjil XI RPL

Quiz
•
11th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade