0% found this document useful (0 votes)
17 views

Course:: The Quiz Questions

The document contains a quiz with questions about Java programming fundamentals. It asks the reader to order code snippets, identify valid Java types, pair code with descriptions, and match logical expressions. The answers are then provided to check the reader's understanding.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Course:: The Quiz Questions

The document contains a quiz with questions about Java programming fundamentals. It asks the reader to order code snippets, identify valid Java types, pair code with descriptions, and match logical expressions. The answers are then provided to check the reader's understanding.

Uploaded by

Fuad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Course: Easy-to-follow Java programming

The quiz questions


Answer the questions below to review what you have learned in Video 1. You will find the
right answers after the questions in the solution part.

1. The elements of the “Hello World” got mixed up. Put them in the right order.

System.out.println("Hello World!");

public class Helloworld {

package helloworld;

public static void main(String[] args) {

}
}

2. Which are NOT a Java type?

a) long
b) int
c) double
d) integer
e) float
f) real
g) word
h) longint
i) int64
j) bool
k) byte

Duckademy IT courses – www.duckademy.com


3. Which are right commands?

a) int a = 6;
b) a: int;
c) int a;
d) int a: 6;
e) int a; a = 6;
f) a: 6 = int;
g) a = 6: int;
h) a = 6;

4. Pair the the reading instruction with the appropriate types.

The beginning of the program:


Scanner sc = new Scanner(System.in);

Let’s suppose the Scanner has been properly imported.

1 sc.nextInt() a String (one line)

2 sc.nextLine() b double

3 sc.next() c int

4 sc.nextDouble() d float

5 sc.nextFloat() e String (one word)

5. Pair the different = signs with their meanings.

1 = a Check if the sides are equal?

2 == b It does not exist in Java

3 === c Assignment to a variable

6. Pair the expressions with the same meanings.

1 a == b a !(a >= 1 && a <= 5)

2 a > 10 && a < 20 b !(a != b)

3 a == 0 || a == 1 || a == 2 c !(a <= 10 || a >= 20)

4 a < 1 || a > 5 d a >= 0 && a <= 2

Duckademy IT courses – www.duckademy.com


-----------------------------------------------------------------------------------------------------------------------

The answers

1. The elements of the “Hello World” got mixed up. The numbers in front of the
lines show their right order.

4 System.out.println("Hello World!");

2 public class Helloworld {

1 package helloworld;

3 public static void main(String[] args) {

5 }
}

package helloworld;
public class Helloworld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

2. Which are NOT a Java type?

a) long
b) int
c) double
d) integer
e) float
f) real
g) word
h) longint
i) int64
j) bool
k) byte

Duckademy IT courses – www.duckademy.com


3. Which are right commands?

a) int a = 6;
b) a: int;
c) int a;
d) int a: 6;
e) int a; a = 6;
f) a: 6 = int;
g) a = 6: int;
h) a = 6;

4. Pair the the reading instruction with the appropriate types.

The beginning of the program:

Scanner sc = new Scanner(System.in);

Let’s suppose the Scanner has been properly imported.

1 sc.nextInt() c int

2 sc.nextLine() a String (one line)

3 sc.next() e String (one word)

4 sc.nextDouble() b double

5 sc.nextFloat() d float

5. Pair the different = signs with their meanings.

1 = c Assignment to a variable

2 == a Check if the sides are equal?

3 === b It does not exist in Java

6. Pair the expressions with the same meanings.

1 a == b b !(a != b)

2 a > 10 && a < 20 c !(a <= 10 || a >= 20)

3 a == 0 || a == 1 || a == 2 d a >= 0 && a <= 2

4 a < 1 || a > 5 a !(a >= 1 && a <= 5)

Duckademy IT courses – www.duckademy.com

You might also like