Interview Question


Country: India




Comment hidden because of low score. Click to expand.
4
of 4 vote

#define square(X) X*X is a MACRO(google it)
and compiler replace the macro with defination
so code become
sq= X*X in our code X is 2+3 so it become 2+3*2+3
so ans=11

- dabbcomputers March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#define square(X) X*X is a MACRO(google it)
and compiler replace the macro with defination
so code become
sq= X*X in our code X is 2+3 so it become 2+3*2+3
so ans=11

- dabbcomputers March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#define square(X) X*X is a MACRO(google it)
and compiler replace the macro with defination
so code become
sq= X*X in our code X is 2+3 so it become 2+3*2+3
so ans=11

- dabbcomputers March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What is the output of the following code?
#include<stdio.h>
void main ( )
{
int s=0;
while (s++<10)
{
if(s<4&&s<9)
continue;
printf(“ %d/t”,s);
}
}

- Anonymous October 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

answer will be 4 5 6 7 8 9 10

- Anonymous June 19, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

output will be 1 2 3 4

- sid January 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it will rather be 1 2 3 4 5 6 7 8 9 10

- sid` January 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int x = 0; for (x=1; x<4; x++); printf("x=%d\n", x);
What will be printed when the sample code above is executed?

- Anonymous May 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

answer will be 4

- Anonymous June 19, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

#define square(v) v*v
Void main()
{
int p=3,s;
s=square(++3);
}
OUTPUT
25
Please explain the macro how the variable incremented....

- Subhashis February 10, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How the answer is 11
For2+3*2+3

- ArbiyA June 13, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#define SQUARE (X)X*X
Void main ()
{
printf ("not square =%d",SQUARE (10+2));
}

- Anonymous July 16, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>
#define SQUARE(X) X*X
#define PR(X) printf("macro is %d\n",X)
main()
{
PR(100/SQUARE(2));
}

- Anonymous January 28, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#define square(x) x*x
main()
{
int i;
i=64/square(4);
printf("%d",i);
}

- Anonymous March 08, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

64

- Akshat August 07, 2019 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More