java computer science test

No Description

Created on 6th January 2025

What is the correct way to declare a variable in Java?

What will be the output of the following code: 'System.out.println(Math.abs(-5));'

Which of the following statements correctly uses an if-else statement?

What is the output of the following code: 'int a = 5; int b = 10; System.out.println(a + b);'

Which of the following is a correct way to use the Math.sqrt() function?

How do you initialize a variable with a floating-point number in Java?

What will be the result of the following code: 'int x = 8; if (x % 2 == 0) { System.out.println('Even'); } else { System.out.println('Odd'); }'

What does the following code snippet do? 'double result = Math.pow(2, 3);'

What will the following code output: 'int x = 5; x += 3; System.out.println(x);'

Which of the following will NOT compile in Java?

Congratulations!

You have answered 0 out of 10 questions correctly.

Your score is 0.00%.