NEW
Font size
WorksheetsREV CODE
Total questions: 15
Worksheet time: 15mins
print("Hello", end='@');
print(" World")
Hello @ World
Hello@ World
Hello @World
end="@" is an invalid argument
A man buys a cycle for Rs. 1400 and sells it at a loss of 15%. What is the selling price of the cycle?
Rs. 1090
Rs. 1160
Rs. 1190
Rs. 1202
x="abcd"
for i in range(len(x)):
print(i)
abcd
a b c d
1234
error
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:
700 kmph
760 kmph
716 kmph
720 kmph
#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;
}
2, 2, 0, 1
1, 2, 1, 0
-2, 2, 0, 0
-2, 2, 0, 1
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?
Rs. 4991
Rs. 4990
Rs. 5000
Rs. 4881
int i = 1, j = -1;
switch (i)
{
case 0, 1: j = 1;
case 2: j = 2;
default: j = 0;
}
System.out.println("j = " + j);
j = -1
j = 0
j = 1
Compilation fails.
A fruit seller had some apples. He sells 40% apples and still has 420 apples. Originally, he had:
720 apples
690 apples
710 apples
700 apples
#include<stdio.h>
#define SQR(x)(x*x)
int main()
{
int a, b=3;
a = SQR(b+2);
printf("%d\n", a);
return 0;
}
25
11
Error
Garbage value
Look at this series:
J14, L16, __, P20, R22, ... What number should fill the blank?
S24
N18
M18
T24
#include <stdio.h>
void main{
int a;
if (a){
printf("welcome");
}
}
a is not initialised
"welcome"
nothing will be printed
complilation error
Which one will replace the question mark ?
25
37
41
47
class Test
{
public static void main(String [] args)
{
int x=20;
String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
System.out.println(sup);
}
}
small
tiny
huge
Compilation fails
my_list = [1, 2, 3, 4]
result = [x if x % 2 == 0 else -x for x in my_list]
print(result)
[1, -2, 3, -4]
[-1, 2, -3, 4]
[1, -2, -3, -4]
[1, -2, 3, 4]
public class Test
{
public static void main (String args[])
{
String str = NULL;
System.out.println(str);
}
}
NULL
Compile Error
Code runs but no output
Runtime Exception
