Search Header Logo

Quiz No.2

Authored by Richard Reforma

Computers

12th Grade

Used 2+ times

Quiz No.2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

FILL IN THE BLANK QUESTION

30 sec • 1 pt

What will be the value of variable a?

int x=25;

int y= 16;

int a=x-y;

System.outprintln(a);

2.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the output of this codes once you run the program?

int currentScore = 50;

int level = 2;

int newScore;

newScore = currentScore * level;

System.out.println("New Score is: " + newScore);

New Score is newScore

New Score is 50

New Score is 100

New Score is 50*2

3.

FILL IN THE BLANK QUESTION

45 sec • 2 pts

What will be the value of variable c?

int a=10;

int b= 5+3;

int c=(a+b)/2;

System.outprintln(c);

4.

MULTIPLE CHOICE QUESTION

30 sec • 2 pts

What is the correct syntax in importing Scanner Class?

import java.Util.Scanner;

import Java.UtilScanner;

import Java.Util,Scanner:

import java.util.Scanner;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. Based on the given codes below, you need to find the error in the codes?

  2.           Scanner in = new Scanner(System.in);  

  3.           System.out.print("Enter your name: ");  

  4.           String name ; in.nextLine();  

  5.           System.out.println("Name is: " + name);             

  6.           

;

:

=

,

6.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

What is the correct output of the program?

int a = 10;

int b = 20;

int c = 25;

System.out.println("b % a = " + (b % a) );

System.out.println("c % a = " + (c % a) );

b % a = 10

c % a = 20

b % a = 0

c % a = 0

b % a = 0

c % a = 5

b % a = 5

c % a = 0

7.

FILL IN THE BLANK QUESTION

1 min • 5 pts

The written code below will accept 3 numbers from the user, what will be the output of the program if I entered 5, 9, and 16?

Scanner input = new Scanner(System.in);

System.out.print("Enter the Number 1 : ");

double n1 = input.nextDouble();

System.out.print("Enter the Number 2 : ");

double n2 = input.nextDouble();

System.out.print("Enter the Number 3 : ");

double n3 = input.nextDouble();

System.out.print("The Average value : " + ((n1 + n2 + n3) / 3 ));

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?