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

C and C++ Interview Questions

Ex 1:

#define float char
void main()
{
      float f=255;
  
    printf("%d",sizeof(f++));
 
}

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

(a)1
(b)2
(c)8
(d)Compiler error

Ans: (a)

Ex - 2:
void main()
{
     char f=255.0;
 
     printf("%d",sizeof(f++));
  
}

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

(a)1
(b)8
(c)10
(d)Compiler error

Ans: (a)

Ex - 3:  
#define value 10\2
void main()
{
   
    printf("%d",value);
   
}

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

(a)5
(b)20
(c)102
(d)Compiler error

Ans: (c)


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