Synopsis Previous Years Solved Sample Placement Papers
-
In the following program, how would you print 50 using
p
?
main()
{
int a[]={10, 20, 30, 40, 50};
char *p;
p = (char*) a;
}Ans: printf("\n%d", *((int*)p + 4));
-
Would the following program compile?
main()
{
int a=10, *j;
void *k;
j = k = &a;
j++;
k++;
printf("\n%u%u", j, k);
}A. Yes
B. No, the format is incorrect
C. No, the arithmetic operation is not permitted on void pointers Answer: Option C
D. No, the arithmetic operation is not permitted on pointers
-
According to ANSI specifications, which is the correct way of declaring
main()
when it receives command line arguments?
A.
main(int argc, char *argv[])
Answer: Option AB.
main(argc, argv) int argc; char *argv[];
C.
main() {int argc; char *argv[]; }
D. None of the above
-
What error would the following function give on compilation?
f(int a, int b)
{
int a;
a = 20;
return a;
}A. missing parenthesis in the return statement
B. The function should be declared as
int f(int a, int b)
C. redeclaration of
a
Answer: Option CD. None of the above
-
Point out the error in the following program:
main()
{
const char *fun();
*fun() = 'A';
}
const char *fun()
{
return "Hello";
}Ans: fun() returns to a "const char" pointer which cannot be modified.
-
Which of the following is an infix expression?
a) (a+b)*(c+d)
b) ab+c*
c) +ab
d) abc+*
Answer: a
Explanation: (a+b)*(c+d) is an infix expression. +ab is a prefix expression and ab+c* is a postfix expression.
-
What is the time complexity of an infix to postfix conversion algorithm?
a) O(N log N)
b) O(N)
c) O(NĀ²)
d) O(M log N)
Answer: b
Explanation: The time complexity of an infix to postfix expression conversion algorithm is mathematically found to be O(N).
-
What is the postfix expression for the corresponding infix expression?
a+b*c+(d*e)
a) abc*+de*+
b) abc+*de*+
c) a+bc*de+*
d) abc*+(de)*+
Answer: a
Explanation: Using the infix to postfix expression conversion algorithm, the corresponding postfix expression is found to be abc*+de*+.
-
Parentheses are simply ignored in the conversion of infix to postfix expression.
a) True
b) False
Answer: b
Explanation: When a parenthesis is encountered, it is placed on the operator stack. When the corresponding parenthesis is encountered, the stack is popped until the other parenthesis is reached and they are discarded.
-
It is easier for a computer to process a postfix expression than an infix expression.
a) True
b) False
Answer: a
Explanation: Computers can easily process a postfix expression because a postfix expression keeps track of precedence of operators.
-
What is the postfix expression for the infix expression?
a-b-c
a) -ab-c
b) ab ā c ā
c) ā -abc
d) -ab-c
Answer: b
Explanation: The corresponding postfix expression for the given infix expression is found to be ab-c- and not abc- -.
-
Select the antonym of capture from the following
A. attack
B. Release Answer: Option B
C. condemn
D. None of the above
-
Find the antonym of autumn
A. Spring Answer: Option A
B. Winter
C. Summer
D. None of the above
-
One skirt requires 3.75 yards of cloth. How many skirts you can make from 45 yards?
Ans: 12 skirts
-
How can you make a square from two triangles?
Solution: By joining the hypotenuses of two right-angled triangles.
-
Is the meaning of Client and Customer,
A. same Answer: Option A
B. contradictory
C. no relation