NEW
Font size
WorksheetsRound 4 - Harvest
Total questions: 15
Worksheet time: 30mins
a = 4.5
b = 2
print(a//b)
2.0
No such operator
Division Error
2
a = True
b = False
c = False
if a or b and c:
print("TECH NEW KAL")
else:
print("tech new kal")
TECH NEW KAL
tech new kal
Syntax Error
Compilation Error
for i in range(2):
print(i)
for i in range(4, 6):
print(i)
2
4
6
1
2
5
0
1
4
5
1
2
4
6
public class Test
{
public static void main(String args[])
{
int i=20+ +9- -12+ +4- -13+ +19;
System.out.println(i);
}
}
37
77
27
66
nameList = ["Harsh", "Prateek", "Bob"]
print(nameList[1][-1])
Bob
k
keetarp
Harsh, Prateek
class Test {
public static void main(String[] args) {
for(int i = 0; true; i++) {
System.out.println("Hello");
break;
}
}
}
Hello
HelloHelloHelloHelloHelloHelloHello
Hello
Hello
Hello
Hello
Infinite loop
for i in [1, 2, 3, 4][::-1]:
print(i)
1
2
3
1
2
3
4
4
3
2
1
4
3
2
for i in range(10,2,-2):
print(i, "Hello")
10 Hello
9 Hello
8 Hello
7 Hello
6 Hello
5 Hello
4 Hello
3 Hello
10 Hello
8 Hello
6 Hello
4 Hello
2 Hello
4 Hello
6 Hello
8 Hello
Hello 2
Hello 4
Hello 6
Hello 8
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);
}
}
Syntax Error
0 0
null null
x y
str = "Python Output based Questions"
word=str.split()
for i in word:
print(i)
Python
Output
Based
Questions
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
Python Output
Based Question
P y t h o n
O u t p u t
Based Question
for (int i = 7; i < 10; i++) {
System.out.println("ProNetiX");
}
System.out.println("ProNetiX");
ProNetiX ProNetiX ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
ProNetiX
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));
true is printed out exactly four times.
true is printed out exactly once.
The code does not compile.
true is printed out exactly three times.
What would be the output of the given python code?
1
2
3
4
5
6
7
1
3
5
7
5
1
2
None of these
print((3>1) and (9<1))
True
False
Syntax Error
None of these
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");
}
}
}
num1 == num2
num3 == num4
num1 == num2
num3 != num4
num1 != num2
num3 == num4
num1 != num2
num3 != num4
