Given the following,
1. public class Test {
2. public static void main(String [] args) {
3. signed int x = 10;
4. for (int y=0; y<5; y++, x--)
5. System.out.print(" " + x);
6. }
7. }
what is the result? (Choose one.)
Java Programming - Quiz 1
Quiz
•
University - Professional Development
•
Hard
Shom Das
Used 49+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following,
1. public class Test {
2. public static void main(String [] args) {
3. signed int x = 10;
4. for (int y=0; y<5; y++, x--)
5. System.out.print(" " + x);
6. }
7. }
what is the result? (Choose one.)
10 9 8 7 6
9 8 7 6 5
Compilation fails
An exception is thrown at runtime
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which one of these lists contains only Java programming language keywords? (Choose one.)
class, if, void, long, Int, continue
goto, instanceof, native, finally, default, throws
try, virtual, throw, final, volatile, transient
strictfp, constant, super, implements, do
byte, break, assert, switch, include
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the numerical range of a char? (Choose one.)
–128 to 127
–(2 ^ 15) to (2 ^ 15) - 1
0 to 32767
Platform dependent
0 to 65535
4.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which three are valid declarations of a float? (Choose three.)
float f1 = -343;
float f2 = 3.14;
float f3 = 0x12345;
float f6 = 2.81F;
float f5 = 2001.0D;
5.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which two demonstrate encapsulation of data? (Choose Two)
Member data have no access modifiers.
Member data can be modified directly.
The access modifier for methods is protected.
The access modifier to member data is private.
Methods provide for access and modification of data.
6.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which two valid declarations of a char? (Choose Two)
char ch = “a”;
char ch = ‘\’ ‘;
char ch = ‘cafe’;
char ch = ‘\ucafe’;
char ch = (char) true;
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given:
1. public class returnIt (
2. returnType methodA(byte x, double y) (
3. return (short) x/y * 2;
4. )
5. )
What is the valid returnType for methodA in line 2 ?
int
double
long
short
float
20 questions
Programming in C(1)
Quiz
•
University
20 questions
Data Type
Quiz
•
University - Professi...
15 questions
Java Quiz based on array
Quiz
•
University
15 questions
C++ Quiz-1
Quiz
•
University
15 questions
quiz pertemuan 2 asik ddp
Quiz
•
University
20 questions
ict5_mt_w2_sw2
Quiz
•
12th Grade - University
15 questions
DSBS-AN-29.01.2024
Quiz
•
Professional Development
15 questions
Computación básica - Conceptos básicos
Quiz
•
Professional Development
25 questions
Equations of Circles
Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)
Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System
Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers
Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons
Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)
Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review
Quiz
•
10th Grade