
Quiz6

Quiz
•
Computers
•
University
•
Hard
Ms. Asst.Prof
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the below code?
public static void main(String args[]) {
short number = 32767;
short numberTwo = (short)(number + 1);
System.out .println(numberTwo);
compilation error: cannot convert from int to short
32767
32768
-32768
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If an arithmetic expression contains variables of int, byte and short data types, what will be the data type of its result?
int
byte
float
short
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the below code?
public class Tester {
public boolean checkTemp(int temp) / if (temp > 100) (
return true;
} else {
return false;
}
public static void main(String args []) {
Tester tester » new Tester ();
if (tester.checkTemp(110)) {
System.out.println("Data is valid");
else {
System.out.printin("Data is invalid");
Data is invalid
Data is valid
true
false
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Tester {
pudlic void demoMethod()
int varone = 1000;
float varTwo = 20.00f;
double varThree = 0.0;
varThree = (double) (varTwo + varone * (7.0 / 100));
System.out.println("varThree:" + varThree);
)
public static void main(String args []) {
Tester tester = new Tester();
tester.demoMethod ();
varThree:20.0
varThree:90.0
varThree:1020.0
varThree:0.0
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the output of the below code?
public class Tester {
public int subtract(int a, int b) {
return (a - b);
public static void main(String args[]) {
int a = 10;
int b = 20;
Tester tester = new Tester ();
int res • tester.subtract(b, a);
System.out.print]n(res);
0
-10
10
Compilation error: the name of the formal and actual parameters must be the same
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Identify the number of instances and local variables present in the Student class given below.
public class Student {
public int rollNo;
public string studentName;
public void findGrade(int marks) {
char grade;
if (marks > 90)
grade = 'A';
else if (marks < 90 && marks > 80)
grade = 'B';
else if (marks < 80 && marks > 70)
grade = 'C';
else
grade = 'D';
System.out.printIn(grade);
}
2 instance variables, 2 local variables
3 instance variables, 1 local variables
2 instance variables, 1 local variables
4 instance variables, 0 local variables
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Tester {
public int add(int a, int b) {
return (a + b);
}
public static void main(String args []) {
int a = 10;
int b = 20;
int sum = 0;
Tester tester = new Tester ();
tester.add(a, b);
System.out.printIn(sum);
}
}
10
0
20
30
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
CODE ZENITH

Quiz
•
University
10 questions
Basics Of C Programming

Quiz
•
University
10 questions
PHP Tours Meetup #22 (Super Apéro)

Quiz
•
University - Professi...
7 questions
Union in c 10

Quiz
•
University
15 questions
java básico y pilas

Quiz
•
University
8 questions
Проверим, что мы помним!

Quiz
•
University
10 questions
C - Pointers

Quiz
•
University
10 questions
java script

Quiz
•
University
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
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University