[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Placement Questions & Answers :: Nagarro

61. main()
{
int a=b=c=d=10; // error: 'b' , 'c', 'd' undeclared
printf("%d,%d,%d,%d",a,b,c,d);
}

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

62. What does the following declaration mean?
int (*ptr)[10];

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

63. main()
{
char a= 'a',*p; p=&a;
printf("%d,%d",sizeof(*p) , sizeof(p));
}

Answer:

Explanation:

Note: sizeof(p) is 2 for 16 bit m/c and 4 for 32 bit m/c

Workspace

Tags:

Wipro NLTH Nagarro 

64. #include
main()
{
if(printf("O", printf("Two"))) // prints content of printf statement and takes length of
//the string for if case execution in this case its 4, So true
printf("Q4I");
else
printf("interview");
}

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

65. #include
int main()
{
printf("%d", printf("%d", printf("%d",543210)));
return 0;
}

Answer:

Explanation:

Note: First prints inner message 543210
then its length in outer printf 6 then its length in outer printf 1
Hence output : 54321061

Workspace

Tags:

Wipro NLTH Nagarro 

66. #include
struct student
{
int stuid=1234;
char stuname[5]= "abcde"; //invalid can't initialize members
}s1;

main()
{
struct student s1;
printf( "%d,%s",s1.stuid,s1.stuname);
}

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

67. #include
main()
{
int a=2;
if(a-- , --a, a) // if(2, 0, 0) last value 0 →False
printf("Tom");
else
printf("Jerry");
}

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

68. Comment on the below while statement=
while (0 == 0) { }

Answer:

Explanation:

while( 0==0) {} is equivalent to while(1) {}

Workspace

Tags:

Wipro NLTH Nagarro 

69. int main()
{
int a=10,*p; p=&a;
printf("%d",*&*p);
}

Answer:

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Wipro NLTH Nagarro 

70. #include
main()
{
int x=10,y=-10;
printf("%x \t",x<<2); // %X hexadeciamal value displayed
printf("%x\t",y>>2);
}

Answer:

Explanation:

Note : here 16 bit computer is considered.
In bitwise operations if number is +ve then simply specied number of bits shifted in specified direction L or R.
If Number is –VE then 2's complement is used Therefore -10 = 1111 0110 = F5 (2's complement)
after 2positions shift → 1111 1101 → FD
in decimal → 1111 1101→10000 0011 → -03

Workspace

Tags:

Wipro NLTH Nagarro