Q. What is the element of the stack once all the elements listed below are pushed onto?
First Element -> {4,2,1,4,5,3,7,8} ->Last Element
Further operations ->
Pop, Pop, Push (3)
A. 3
B. 7
C. 4
D. 1
Ans. a
Q. What is the output of the below code?
int main()
{
int i, j;
for(i=1, j=1; i<=j; i++, j--)
{
printf(“%d”,(i));
}
return 0;
}
A. Compilation Error.
B. Nothing will print.
C. 1
D. Loop will execute infinite time.
Ans. c
Q. Find the output :
import java.io.*;
import java.lang.;
import java.util.*;
class One{
public void travel_greece()
{
int miles = 6000;
}
}
class Two extends One {
public void print_for() {System.out.println(“Greece”)
}
public class Main {
public static void main(String[] argos)
{
Two gr = new Two();
gr.travel_greece();
gr.print_for();
}
}
A. Compilation Error.
B. 6000
C. Greece
D. No Output
Ans. c
Q When we traverse the binary search tree in inorder we get the output in which order?
A. Increasing order
B. Random order
C. Decreasing order
D. Linear order
Ans. a
Q
#define VAR_A 4
#define VAR_B 4
#define ALL_VAR VAR_A + VAR_B
Consider the above macros and evaluate the result of the following.
res=ALL_VAR * ALL_VAR
A. 8
B. 64
C. 24
D. 16
Ans. b