Java Programming Basics

👁 14
statistics
by Dr. Osama M. Khaled last modified 2022-07-19T05:23:40+01:00

Test your knowledge with some basic knowledge of Java

Questions #: 8
Time:
Pass Score: 80.0%
Style
Mode

What is the correct statement to print "Hello World" (without double quotes)?

POINTS (1)

Correct Answer

Explanation


What is the result of the following calculation?

1 public class Main {
2 public static void main(String[] args) {
3 // Write your code here
4 int a = 3;
5 int b = 4;
6 int c = 5;
7 System.out.println(a + b * c + b);
8 }
9 }
POINTS (1)

Correct Answer

Explanation


What is the result of the following calculation?

public class Ex { 
public static void main(String[] args) {
System.out.println(5 + 15 / 3 * 2 - 8 % 3);
}
}
Missing
POINTS (1)

Correct Answer

Explanation


Is string concatenation using '+' allowed in Java?

POINTS (1)

Correct Answer

Explanation


What is the result of print statement in this Java program (+=)?

public class AssShortcutExample {
   public static void main(String args[]) {
      int num1 = 10;
      int num2 = 20;

      num2 += num1;
      System.out.println("= Output: "+num2);
}
}
Missing
POINTS (1)

Correct Answer

Explanation


What is the result of print statement in this Java program (-=)?

public class AssShortcutExample {
   public static void main(String args[]) {
      int num1 = 10;
      int num2 = 20;

      num2 -= num1;
      System.out.println("= Result: "+num2);
}
}
Missing
POINTS (1)

Correct Answer

Explanation


What is the difference between float and double data types in Java?

POINTS (1)

Correct Answer

Explanation


What is the difference between int and long in Java?

POINTS (1)

Correct Answer

Explanation


Views:
Trials:
Avg score: