wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Round 4 - Harvest

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.

a = 4.5

b = 2

print(a//b)

a)

2.0

b)

No such operator

c)

Division Error

d)

2

2.

a = True

b = False

c = False

if a or b and c:

print("TECH NEW KAL")

else:

print("tech new kal")

a)

TECH NEW KAL

b)

tech new kal

c)

Syntax Error

d)

Compilation Error

3.

for i in range(2):

print(i)

for i in range(4, 6):

print(i)

a)

2

4

6

b)

1

2

5

c)

0

1

4

5

d)

1

2

4

6

4.

public class Test  

{  

public static void main(String args[])  

{  

int i=20+ +9- -12+ +4- -13+ +19;  

System.out.println(i);  

}  

}  

a)

37

b)

77

c)

27

d)

66

5.

nameList = ["Harsh", "Prateek", "Bob"]

print(nameList[1][-1])

a)

Bob

b)

k

c)

keetarp

d)

Harsh, Prateek

6.

class Test {

    public static void main(String[] args) {

        for(int i = 0; true; i++) {

            System.out.println("Hello");

            break;

        }

    }

}

a)

Hello

b)

HelloHelloHelloHelloHelloHelloHello

c)

Hello

Hello

Hello

Hello

d)

Infinite loop

7.

for i in [1, 2, 3, 4][::-1]:

print(i)

a)

1

2

3

b)

1

2

3

4

c)

4

3

2

1

d)

4

3

2

8.

for i in range(10,2,-2):

print(i, "Hello")

a)

10 Hello

9 Hello

8 Hello

7 Hello

6 Hello

5 Hello

4 Hello

3 Hello

b)

10 Hello

8 Hello

6 Hello

4 Hello

c)

2 Hello

4 Hello

6 Hello

8 Hello

d)

Hello 2

Hello 4

Hello 6

Hello 8

9.

class Test {

    protected int x, y;

class Main {

    public static void main(String args[]) {

        Test t = new Test();

        System.out.println(t.x + " " + t.y);

    }

}

a)

Syntax Error

b)

0 0

c)

null null

d)

x y

10.

str = "Python Output based Questions"

word=str.split()

for i in word:

print(i)

a)

Python

Output

Based

Questions

b)

P y t h o n

O u t p u t

b a s e d

Q u e s t i o n s

c)

Python Output

Based Question

d)

P y t h o n

O u t p u t

Based Question

11.

for (int i = 7; i < 10; i++) {

System.out.println("ProNetiX");

}

System.out.println("ProNetiX");

a)

ProNetiX ProNetiX ProNetiX

b)

ProNetiX

ProNetiX

ProNetiX

ProNetiX

ProNetiX

ProNetiX

c)

ProNetiX

ProNetiX

ProNetiX

d)

ProNetiX

ProNetiX

ProNetiX

ProNetiX

12.

String s1 = "Java";  

String s2 = "Java";  

StringBuilder sb1 = new StringBuilder();  

sb1.append("Ja").append("va");  

System.out.println(s1 == s2);  

System.out.println(s1.equals(s2));  

System.out.println(sb1.toString() == s1);  

System.out.println(sb1.toString().equals(s1));  

a)

true is printed out exactly four times.

b)

true is printed out exactly once.

c)

The code does not compile.

d)

true is printed out exactly three times.

13.

What would be the output of the given python code?

a)

1

2

3

4

5

6

7

b)

1

3

5

7

c)

5

1

2

d)

None of these

14.

print((3>1) and (9<1))

a)

True

b)

False

c)

Syntax Error

d)

None of these

15.

public class Demo{

public static void main(String[] arr){

Integer num1 = 100;

Integer num2 = 100;

Integer num3 = 500;

Integer num4 = 500;

if(num1==num2){

System.out.println("num1 == num2");

}

else{

System.out.println("num1 != num2");

}

if(num3 == num4){

System.out.println("num3 == num4");

}

else{

System.out.println("num3 != num4");

}

}

}

a)

num1 == num2

num3 == num4

b)

num1 == num2

num3 != num4

c)

num1 != num2

num3 == num4

d)

num1 != num2

num3 != num4