unit 3 practice question set 8

unit 3 practice question set 8

9th - 12th Grade

10 Qs

quiz-placeholder

Similar activities

Basics in Java

Basics in Java

9th - 12th Grade

15 Qs

1.3.5 Pemboleh ubah

1.3.5 Pemboleh ubah

10th Grade

13 Qs

Java- Session: 5-10

Java- Session: 5-10

8th - 10th Grade

10 Qs

Loops

Loops

9th - 12th Grade

10 Qs

Java  Quiz (Who knows java best?)

Java Quiz (Who knows java best?)

7th - 10th Grade

10 Qs

Class X - Java 1

Class X - Java 1

10th Grade

15 Qs

Logic Building in Java Part 1

Logic Building in Java Part 1

6th - 9th Grade

10 Qs

Informatik - Objekt vs. Klasse

Informatik - Objekt vs. Klasse

10th Grade

10 Qs

unit 3 practice question set 8

unit 3 practice question set 8

Assessment

Quiz

Computers

9th - 12th Grade

Easy

Created by

Caleb Kim

Used 2+ times

FREE Resource

10 questions

Show all answers

1.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    int x =2;
    int y =3;

    System.out.println(x + " + "+ y + " = " +adder(y,x));
   }

 public static int adder(int x, int y)
 {
    return x+y;
 }
}

2.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    int x =2;
    int y =3;
    int answer = subtracter(x,y);

    System.out.println(x + " - "+ y + " = " +answer);
   }

 public static int subtracter(int x, int y)
 {
    return x-y;
 }
}

3.

FILL IN THE BLANK QUESTION

1 min • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    int x =2;
    int y =3;
    int answer = subtracter(y,x);

    System.out.println(x + " - "+ y + " = " +answer);
   }

 public static int subtracter(int x, int y)
 {
    return x-y;
 }
}

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    int x = 5;
int y = 2;

System.out.println(mystery(x,y));
   }

 public static int mystery(int x, int y)
 {
    return x+y;
 }

public static double mystery(double x, double y)
{
  return x-y;
}

public static double mystery(double x, int y)
{
  return x/y;
}

public static int mystery(int a)
{
  return (int)(Math.pow(a,2));
}
}

3.5

2.5

7

error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    int x = 5;
int y = 2;

System.out.println(mystery(x));
   }

 public static int mystery(int x, int y)
 {
    return x+y;
 }

public static double mystery(double x, double y)
{
  return x-y;
}

public static double mystery(double x, int y)
{
  return x/y;
}

public static int mystery(int a)
{
  return (int)(Math.pow(a,2));
}
}

error

25

3.5

7

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    double x = 5;
double y = 2;

System.out.println(mystery(x, y));
   }

 public static int mystery(int x, int y)
 {
    return x+y;
 }

public static double mystery(double x, double y)
{
  return x-y;
}

public static double mystery(double x, int y)
{
  return x/y;
}

public static int mystery(int a)
{
  return (int)(Math.pow(a,2));
}
}

error

7

2.5

3.0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the below code?

public class TestClass
{
 public static void main(String[] args)
 {
    double x = 5;
int y = 2;

System.out.println(mystery(x,y));
   }

 public static int mystery(int x, int y)
 {
    return x+y;
 }

public static double mystery(double x, double y)
{
  return x-y;
}

public static double mystery(double x, int y)
{
  return x/y;
}

public static int mystery(int a)
{
  return (int)(Math.pow(a,2));
}
}

error

2.5

3.0

25

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?