JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
What will be the output of the following pseudocode?

Integer j, m
Set m = 1
Integer a[4] = {1, 1, 0, 2}
a[0] = a[0] - a[1] + a[2]
a[1] = a[1] - a[2]
a[2] = a[2] - a[3]
a[3] = a[0]
m = a[3]
Print m
Options
Anonymous Quiz
42%
0
31%
-2
7%
9
20%
1
What will be the output of the following pseudocode?

Integer p, q, r
Set p = 4, q = 6, r = 8
q = 3 + q
for(each r from 4 to 5)
p = 6 + p
q = (q + q) + p
End for
Print p + q
Options
Anonymous Quiz
16%
70
47%
102
9%
97
28%
88
What will be the output of the pseudocode?

Integer p, q, r;
Set p = 0, q = 6, r = 7
r = r + r
for(each r from 4 to 7)
q = (10 & 2) + q
End for
Print p + q
Options
Anonymous Quiz
11%
15
50%
10
36%
14
3%
26
What will be the output of the following pseudocode?

Integer p, q, r
Set p = 8, q = 3, r = 14
q = (p + q) + q
q = 11 ^ r
q = q + r
q = (r ^ 6) & r
Print p + q + r
Options
Anonymous Quiz
13%
34
38%
30
35%
40
15%
26
Which will be the output of the following pseudocode?

Integer p, q, r
Set p = 1, q = 2, r = 4
for(each r from 4 to 7){
q = (r + 11) & p
if((q + 6) > (r -q))
continue
Else
Jump out of the loop
End if
q = r + q
End for
Print p + q
Options
Anonymous Quiz
9%
2
41%
1
41%
12
9%
-18
What will be the output of the following pseudocode?

Integer p, q, r
Set p = 4, q = 4, r = 8
q = 8 + r
if((p + q) < (q-p))
if((p ^ q ^ r) < (q + r + p))
r = (11 & 7) ^ p
p = (11 ^ 8) + q
End if
q = (p + q) + r
End if
q = (p + q) + r
Print p + q + r
Options
Anonymous Quiz
19%
44
32%
50
23%
37
26%
40
Will the following code compile correctly?

abstract class AirPlane{
abstract void fly();
void land(){//Line 3
System.out.println("Landing ........");
}
}
class AirJet extends AirPlane{
AirJet(){
super();//Line 9
}
void fly(){
System.out.println("Flying ........");
}
}
What will be the output of the following code?

class A{
int i=10;
public void printValue(){
System.out.print("Value-A ");
}
}
class B extends A{
int i=12;
public void printValue(){
System.out.print("Value-B ");
}
}
public class Main
{
public static void main(String[] args) {
A a=new B();
a.printValue();
System.out.println(a.i);
}
}
What will be the output?

public class Main
{
public static void main(String[] args) {
int num1, num2;
try{
num1 = 0;
num2 = 62/num1;
System.out.println("Try block message");
System.exit(0);
} catch(ArithmeticException e){
System.out.println("Error : Don't divide a number by zero");
System.exit(0);
} finally {
System.out.println("Give another number of num1");
}
}
}
Choose the correct option.

Which code segment should be used in place of missing Statement in the below code such that it displays the list of all root directories of the available system?

// Missing Statement

for(int i=0;i<dirs.length;i++)
System.out.println("Root["+i+"] : "+dirs[i]);