
Competitive Programming Lab Quiz- 4B
Quiz
•
•
•
Hard
Chayapathi R
Used 7+ times
FREE Resource
Enhance your content
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Solution{
public static void main(String[] args){
short x = 10;
x = x * 5;
System.out.print(x);
}
}
compilation Error
Generates Exception
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Solution{
public static void main(String[] args){
int[] x = {120, 200, 016};
for(int i = 0; i < x.length; i++){
System.out.print(x[i] + “ “);
}
}
}
none
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Identify the correct restriction on static methods.
I. They must access only static data
II. They can only call other static methods.
III. They cannot refer to this or super.
I and II
II and III
Only III
All of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class ArraysInJava
{
public static void main(String[] args)
{
int[] i = new int[-1];
i[1]=20;
System.out.println(i[1]);
}
}
This code will compile and run without any issues with the output 20
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Identify the corrected definition of a package.
A package is a collection of editing tools
A package is a collection of classes
A package is a collection of classes and interfaces
A package is a collection of interfaces
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of following Java code?
public class Main {
public static void main(String arg[]) {
int i;
for (i = 1; i <= 12; i += 2) {
if (i == 8) {
System.out.println(i);
break;
}
}
}
}
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import java.util.Scanner;
class ThisKeyword {
private int a = 4;
private int b = 1;
void getSum(int a, int b) {
this.a = a;
this.b = b;
System.out.println(this.a + this.b);
}
}
public class Main {
public static void main(String args[]) {
ThisKeyword T = new ThisKeyword();
T.getSum(3, 5);
}
}
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
Discover more resources for
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade