Java Programming - Quiz 1

Java Programming - Quiz 1

University - Professional Development

20 Qs

quiz-placeholder

Similar activities

MIDTERM EXAM

MIDTERM EXAM

University

18 Qs

Programming Concepts in C

Programming Concepts in C

University

20 Qs

C++ Quiz-1

C++ Quiz-1

University

15 Qs

Java Operators

Java Operators

Professional Development

15 Qs

core java 2

core java 2

Professional Development

25 Qs

PEMOGRAMAN BERORINTASI OBJECK XII_I

PEMOGRAMAN BERORINTASI OBJECK XII_I

Professional Development

20 Qs

Datatypes and Flowcontrol

Datatypes and Flowcontrol

Professional Development

15 Qs

Java Quiz based on array

Java Quiz based on array

University

15 Qs

Java Programming - Quiz 1

Java Programming - Quiz 1

Assessment

Quiz

University - Professional Development

Hard

Created by

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?