

Java Programming
Presentation
•
Computers
•
2nd Grade
•
Practice Problem
•
Hard
Dr. K
Used 1K+ times
FREE Resource
1 Slide • 22 Questions
1
Java Programming

2
Multiple Choice
What is the range of short data type in Java?
-128 to 127
-32768 to 32767
-2147483648 to 2147483647
None of the mentioned
3
Multiple Choice
Modulus operator, %, can be applied to which of these?
Integers
Floating – point numbers
Both Integers and floating – point numbers
None of the mentioned
4
Multiple Choice
class evaluate {
public static void main(String args[]) {
int a[] = {1,2,3,4,5}; int d[] = a; int sum = 0;
for (int j = 0; j < 3; ++j)
sum += (a[j] * d[j + 1]) + (a[j + 1] * d[j]);
System.out.println(sum); } }
38
39
41
40
5
Multiple Choice
Which of these can be returned by the operator &?
Integer
Boolean
Character
Integer or Boolean
6
Multiple Choice
class dynamic_initialization {
public static void main(String args[]) {
double a, b; a = 3.0; b = 4.0;
double c = Math.sqrt(a * a + b * b);
System.out.println(c); } }
5.0
25.0
7.0
Compilation Error
7
Multiple Choice
When Overloading does not occur?
More than one method with same name but different method signature and different number or type of parameters
More than one method with same name, same signature but different number of signature
More than one method with same name, same signature, same number of parameters but different type
More than one method with same name, same number of parameters and type but different signature
8
Multiple Choice
Which of these statements are incorrect?
Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms
Assignment operators run faster than their equivalent long forms
Assignment operators can be used only with numeric and character data type
None of the mentioned
9
Multiple Choice
class increment {
public static void main(String args[]) {
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " + var4); } }
1 1
0 1.5
1.5 1
1 1.5
10
Multiple Choice
class increment {
public static void main(String args[]) {
int g = 3;
System.out.print(++g * 8); } }
24
32
25
34
11
Multiple Choice
class Output {
public static void main(String args[]) {
int a = 1; int b = 2; int c; int d;
c = ++b;
d = a++;
c++;
b++;
++a;
System.out.println(a + " " + b + " " + c); } }
4 4 3
3 3 4
3 4 4
4 3 3
12
Multiple Choice
class bitwise_operator {
public static void main(String args[]) {
int var1 = 42;
int var2 = ~var1;
System.out.print(var1 + " " + var2); } }
42 42
42 -43
43 42
43 -42
13
Multiple Choice
class bitwise_operator {
public static void main(String args[]) {
int a = 3;
int b = 6;
int c = a | b;
int d = a & b;
System.out.println(c + " " + d); } }
7 2
7 5
5 7
7 7
14
Multiple Choice
class leftshift_operator {
public static void main(String args[]) {
byte x = 64; int i; byte y;
i = x << 2;
y = (byte) (x << 2)
System.out.print(i + " " + y); } }
0 256
256 0
0 64
256 1
15
Multiple Choice
class rightshift_operator {
public static void main(String args[]) {
int x; x = 10;
x = x >> 1;
System.out.println(x); } }
2
7
5
10
16
Multiple Choice
Which of these keywords can be used to prevent Method overriding?
static
constant
protected
final
17
Multiple Choice
At line number 2 in the following code, choose 3 valid data-type attributes/qualifiers among “final, static, native, public, private, abstract, protected”
public interface Status {
/* insert qualifier here */ int MY_VALUE = 10;
}
final, native, private
final, static, protected
final, private, abstract
final, static, public
18
Multiple Choice
What will be the output of the following Java program?
class Alligator {
public static void main(String[] args) {
int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
int [][]y = x;
System.out.println(y[2][1]); } }
2
3
7
Compilation Error
19
Multiple Choice
What will be the output of the following Java program?
class Abc {
public static void main(String[]args) {
String[] elements = { "for", "tea", "too" };
String first = (elements.length > 0) ? elements[0]: null; } }
Compilation error
An exception is thrown at run time
The variable first is set to null
The variable first is set to elements[0]
20
Multiple Choice
What will be the output of the following Java program?
class selection_statements {
public static void main(String args[]) {
int var1 = 5; int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2); } }
1
3
2
5
21
Multiple Choice
What will be the output of the following Java program?
class Output {
public static void main(String args[]) {
final int a=10,b=20;
while(a<b)
{
System.out.println("Hello"); }
System.out.println("World"); } }
Hello
run time error
Hello world
compile time error
22
Multiple Choice
What will be the output of the following Java program?
class Alligator {
public static void main(String[] args) {
int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}};
int [][]y = x;
System.out.println(y[2][1]); } }
2
3
7
Compilation Error
23
Multiple Choice
class increment {
public static void main(String args[]) {
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " + var4); } }
1 1
0 1.5
1.5 1
1 1.5
Java Programming

Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
16 questions
Mr. Stein spelling lesson #12
Presentation
•
2nd - 3rd Grade
20 questions
Tipos Primitivos
Presentation
•
3rd Grade
20 questions
Python основы
Presentation
•
KG
15 questions
Forces 12/1/23
Presentation
•
1st Grade
23 questions
3rd P1Q2 In-Class Review
Presentation
•
2nd Grade
18 questions
Python 8 класс итог
Presentation
•
1st Grade
17 questions
Python
Presentation
•
1st Grade
14 questions
Temas Bimestre II
Presentation
•
1st - 3rd Grade
Popular Resources on Wayground
5 questions
A Home on the Shore
Quiz
•
3rd Grade
28 questions
US History Regents Review
Quiz
•
11th Grade
6 questions
A Horse Tale
Quiz
•
3rd Grade
20 questions
Math Review
Quiz
•
3rd Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
20 questions
Dividing Fractions
Quiz
•
5th Grade
55 questions
A Long Walk to Water Final Review
Quiz
•
6th - 8th Grade
10 questions
Equation Word Problems
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
3rd grade Context Clues
Quiz
•
2nd - 3rd Grade
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
16 questions
Capitalization and Punctuation
Quiz
•
2nd - 3rd Grade
13 questions
Addition and Subtraction
Quiz
•
2nd Grade
30 questions
Multiplication Facts 1-12
Quiz
•
2nd - 5th Grade
19 questions
Animal Trivia
Quiz
•
2nd Grade
30 questions
Prefix (re-, pre-,mis-, un-)
Quiz
•
2nd - 3rd Grade
18 questions
Trivia Questions
Presentation
•
1st - 6th Grade