© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

C and C++ Interview Questions

Ex 4:

#define xxx 11\3
void main()
{
 
    printf("%ld",xxx);
 
}

What will be output if you compile and execute the above code?

(a)11
(b)3
(c)113
(d)Compiler error

Ans: (c)

Ex - 5:
#define option1 a++; printf("%d",a);
#define option2 print("%d",a);
void main()
{
    int a=10;
   
    if(a++)
       option1

    else
   option2;
 
}

What will be output if you compile and execute the above code?

(a)10
(b)11
(c)12
(d)Compiler error

Ans: (d)

Ex - 6:  
//test.c

void main()
{
   
    printf("%s",__FILE__);
   
}

What will be output if you compile and execute the above code?

(a)null
(b)test.c
(c)url of current working directory
(d)Compiler error

Ans: (b)


1 >> 2 >> 3 >> 4 >> 5
SLogix Student Projects
bottom