Competitive Programming Lab Quiz- 4B

Competitive Programming Lab Quiz- 4B

20 Qs

quiz-placeholder

Similar activities

isaiah frends

isaiah frends

6th Grade

15 Qs

https://app.classcraft.com/student/class/R9HNefTMmPEiXApPE/home

https://app.classcraft.com/student/class/R9HNefTMmPEiXApPE/home

4th Grade

15 Qs

adjectives

adjectives

KG - University

15 Qs

nouns

nouns

6th Grade

15 Qs

Harlem Renaissance

Harlem Renaissance

12th Grade

15 Qs

SafeSplash 2020 March Meeting

SafeSplash 2020 March Meeting

KG - University

20 Qs

Agile Quiz 14.12.2023

Agile Quiz 14.12.2023

KG - University

24 Qs

revising and editing 4th grade staar

revising and editing 4th grade staar

5th Grade

15 Qs

Competitive Programming Lab Quiz- 4B

Competitive Programming Lab Quiz- 4B

Assessment

Quiz

Hard

Created by

Chayapathi R

Used 7+ times

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Solution{

       public static void main(String[] args){

                     short x = 10;

                     x =  x * 5;

                     System.out.print(x);

       }

}

The code will print 50
The code will print 10

compilation Error

Generates Exception

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Solution{

       public static void main(String[] args){

               int[]  x = {120, 200, 016};

               for(int i = 0; i < x.length; i++){

                        System.out.print(x[i] + “ “);

               }                  

       }

}

120 200 16
120 200 016
120 200 14

none

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Identify the correct restriction on static methods.

  1. I. They must access only static data

  2. II. They can only call other static methods.

  3. III. They cannot refer to this or super.

I and II

II and III

Only III

All of the above

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class ArraysInJava

{

public static void main(String[] args)

{

int[] i = new int[-1];

i[1]=20;

System.out.println(i[1]);

}

}

This code will compile and run without any issues with the output 20

This code will throw an ArrayIndexOutOfBoundsException
This code will throw a NegativeArraySizeException
This code will throw a NullPointerException

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Identify the corrected definition of a package.

 

A package is a collection of editing tools

A package is a collection of classes

A package is a collection of classes and interfaces

A package is a collection of interfaces

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of following Java code?

public class Main {

  public static void main(String arg[]) {

    int i;

    for (i = 1; i <= 12; i += 2) {

      if (i == 8) {

        System.out.println(i);

        break;

      }

    }

  }

}

8
1, 3, 5, 7, 9, 11
1, 3, 5, 7
No output

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

import java.util.Scanner;

 

class ThisKeyword {

  private int a = 4;

  private int b = 1;

 

  void getSum(int a, int b) {

    this.a = a;

    this.b = b;

    System.out.println(this.a + this.b);

  }

}

 

public class Main {

  public static void main(String args[]) {

    ThisKeyword T = new ThisKeyword();

    T.getSum(3, 5);

  }

}

The output will be 8
The output will be 5
The output will be 9
The output will be 7

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?