# DeShaw Placement Papers - Technical Questions

## DeShaw Placement Papers – Technical Questions

• What shall be the output of the below mentioned program?

#include
main()
{
Struct s1 {int I; };
Struct s2 {int I;};
Struct s1 st1;
Struct s2 st2;
St1.i=5;
St2 = st1;
Printf(“%d”,st2.i);
}

• What shall be the output for the below mentioned ‘C’ program?

#define AREA(x)(3.14*x*x)
main()
{floatr1=6.25,r2=2.5,a;
a=AREA(r1);
printf(“
Area of the circle is%f”,a);
A=AREA(r2);
Printf(“
Area of the circle is %f”,a);
}

• Explain the following statements, what do they indicate?

Int(*p)
Int*f()
Int(*pf)()
Int*p

• Write an algorithm for finding the GCD of a number?

• How will you swap two variables x and y without using a temporary variable?

• Write a C program that reverses the linked list

• If you have to check if a stack is progressing in forward or reverse direction, which C program will you write to find the same?

• If you have to find a missing integer where the integers from 1 to n are stored in an array in a random fashion but one integer is missing, which program will you choose to write?

• In the given program, what does ‘nodeptr’ stand for?

Typedef struct{
Char*;
Nodeptr next;
}* nodeptr;

• a=10; b=5; c=3; d=3
if (aprintf(%d %d %d %d a, b, c, d)
else printf(“%d %d %d %d a, b, c, d);

• ‘-‘=45 ‘/’=47
Printfr(%d/n, ‘-‘, ‘-‘, ‘-‘, ‘-‘,’/’, ‘/’, ‘/’);
o/p=?
12.o/p=?
int I;
i=1;
i=i+2*i++;
printf(%d,i);

• What shall be the output of the following program when supposing that each integer occupies 4 bytes and each character 1 byte?

#include
Main()
{
Int a[]={1,2,3,4,5,6,7};
Char c[] = { a, x, h, o, k};
Printf(“%d %d”, (&a-&a),(&c-&c));

a. 3.3
b. 3
c. 2.3
d. 3.5

• Int a=1; b=2, c=3; *pointer;
Pointer=&c;
a=c/*pointer
b=c;
printf(“a=%d b=%d”,a,b,);

a. 3 2
b. a=1 b=3
c. a=3 b=3
d. error

• FILE*fp1,*fp2;
Fp1=fopen(“one,”w”)
Fp2=fopen(“one”,”w”)
Fputc(‘A’,fp1)
Fputc(‘B’,fp2)
Fclose(fp1)
Fclose(fp2)}

a. Error
b. No error
c. None of the above

• Solve:
Int sum(n)
Int n;
If(N<1)return n;
Else return (n+sum (n-1))

a. 16
b. 15
c. 10
d. 14

• Find the output of the following program:

Main()
{int i=3;
While(i--)
{
Int i=100
i--;
printf(“%d..”,I”);
}
}

a. Error
b. 3..22..1..
c. Infinite loop
d. 99..99..99..99