wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

REV CODE

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

print("Hello", end='@');

print(" World")

a)

Hello @ World

b)

Hello@ World

c)

Hello @World

d)

end="@" is an invalid argument

2.

A man buys a cycle for Rs. 1400 and sells it at a loss of 15%. What is the selling price of the cycle?

a)

Rs. 1090

b)

Rs. 1160

c)

Rs. 1190

d)

Rs. 1202

3.

x="abcd"

for i in range(len(x)):

print(i)

a)

abcd

b)

a b c d

c)

1234

d)

error

4.

An aeroplane covers a certain distance at a speed of 240 kmph in 5 hours. To cover the same distance in

5/3 hours, it must travel at a speed of:

a)

700 kmph

b)

760 kmph

c)

716 kmph

d)

720 kmph

5.

#include<stdio.h>

int main(){

int i=-3, j=2, k=0, m;

m = ++i || ++j && ++k;

printf("%d, %d, %d, %d\n", i, j, k, m);

return 0;

}

a)

2, 2, 0, 1

b)

1, 2, 1, 0

c)

-2, 2, 0, 0

d)

-2, 2, 0, 1

6.

A grocer has a sale of Rs. 6435, Rs. 6927, Rs. 6855, Rs. 7230 and Rs. 6562 for 5 consecutive months. How much sale must he have in the sixth month so that he gets an average sale of Rs. 6500?

a)

Rs. 4991

b)

Rs. 4990

c)

Rs. 5000

d)

Rs. 4881

7.

int i = 1, j = -1;

switch (i)

{

case 0, 1: j = 1;

case 2: j = 2;

default: j = 0;

}

System.out.println("j = " + j);

a)

j = -1

b)

j = 0

c)

j = 1

d)

Compilation fails.

8.

A fruit seller had some apples. He sells 40% apples and still has 420 apples. Originally, he had:

a)

720 apples

b)

690 apples

c)

710 apples

d)

700 apples

9.

#include<stdio.h>

#define SQR(x)(x*x)

int main()

{

int a, b=3;

a = SQR(b+2);

printf("%d\n", a);

return 0;

}

a)

25

b)

11

c)

Error

d)

Garbage value

10.

Look at this series:

J14, L16, __, P20, R22, ... What number should fill the blank?

a)

S24

b)

N18

c)

M18

d)

T24

11.

#include <stdio.h>

void main{

int a;

if (a){

printf("welcome");

}

}

a)

a is not initialised

b)

"welcome"

c)

nothing will be printed

d)

complilation error

12.

Which one will replace the question mark ?

a)

25

b)

37

c)

41

d)

47

13.

class Test

{

public static void main(String [] args)

{

int x=20;

String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";

System.out.println(sup);

}

}

a)

small

b)

tiny

c)

huge

d)

Compilation fails

14.

my_list = [1, 2, 3, 4]

result = [x if x % 2 == 0 else -x for x in my_list]

print(result)

a)

[1, -2, 3, -4]

b)

[-1, 2, -3, 4]

c)

[1, -2, -3, -4]

d)

[1, -2, 3, 4]

15.

public class Test

{

public static void main (String args[])

{

String str = NULL;

System.out.println(str);

}

}

a)

NULL

b)

Compile Error

c)

Code runs but no output

d)

Runtime Exception