
PEBO
Quiz
•
Other
•
University
•
Practice Problem
•
Medium
Fabian Arasyid
Used 2+ times
FREE Resource
Enhance your content in a minute
24 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Someone has just finished creating a class and wants you to review it:
class DataServer extends Server{
public String serverName;
public DataServer () {
serverName = "Customer Service"; super(serverName);
}
}
What do you tell the programmer:
The code will not compile because there is something wrong in the DataServer method
The code will compile but the error will occurred when the class is instantiated
The code will compile and run fin
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following source file is given the name FirstClass.java
import java.*;
public class FirstClass { }
class SecondClass { }
public class ThirdClass { }
What error will the compiler will likely generate?
public class FirstClass could not be public
public class SecondClass must be defined in other file named "SecondClass.java" because there cannot be more than one class with a public modifier in the same file
class SecondClass must be public
package java not found in import
3.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Which of the following variable definitions are legitimate if it is an instance variable (not class variable)? (choose all that apply)
Public static int a;
private static final int a;
protected int a;
public int a = 1;
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
public class A {
public static void main(String[] args) {
Calculation c = new Calculation();
c.print1();
}
}
class Calculation {
private int number;
public void setNumber(int number) {
this.number = number;
}
public void print1() {
int sum = 0;
for (int i=0; i<this.number;i++){
if (i%2==0)
sum+=i;
}
System.out.println("Sum is"+sum);
}
}
what will be the output when the code is compiled and run?
The code will not compille
10
0
null
20
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
An object is an instantiation of a class. Pernyataan ini dapat diterjemahkan sebagai -sebuah obyek adalah sebuah perwujudan dari sebuah kelas.
true
false
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Examine this code:
public class A {
public static void main(String[] args) {
Calculation c = new Calculation();
c.setNumber(10);
c.print1();
}
}
class Calculation {
private int number;
public void setNumber(int number) {
this.number = number;
}
public void print1() {
int sum = 0;
for (int i=0; i<this.number;i++){
if (i%2==0)
break;
}
System.out.println("Sum is"+sum);
}
}
What will be the output when the code is compiled and run?
The code will not compile
0
20
null
10
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you try to compile and run this class, what will happen?
public class LocalTest {
public static void main(String[] args) {
int i;
i = 20;
System.out.print("int i = " + (++i));
}
}
it will not compile and give the compile error
it will compile and output 21 to the screen
it will compile, but will produce interpreter error when executed
it will compile and output 20 to the screen
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
Expected Vs. Unexpected Behaviors
Quiz
•
5th Grade - University
20 questions
HRM
Quiz
•
University
20 questions
Sports
Quiz
•
1st Grade - University
20 questions
Cryptography
Quiz
•
University
20 questions
BAHASA INGGRIS LINTAS MINAT
Quiz
•
University
20 questions
Ch 4 - States of Consciousness
Quiz
•
University
20 questions
Security Risk Management
Quiz
•
University
20 questions
แบบทดสอบ Pretest เรื่องการช่วยฟื้นคืนชีพขั้นพื้นฐาน
Quiz
•
University
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 Other
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University
