Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

Technical Interview Questions

C++ Interview Questions
C# Interview Questions
C Interview Questions

Aptitude Interview Questions
C ++ Aptitude Question 1
C Aptitude Questions

C Tutorial
C++ Tutorial

Programming Source Codes
C/C++ Source Codes
C# Source Codes

Online Quiz
C Online Quiz
C++ Online Quiz

Soft Skills
Communication Skills
Leadership Skills




C++ Aptitude Questions and Answers

Base class has some virtual method and derived class has a method with the same name. If we initialize the base class pointer with derived object, calling of that virtual method will result in which method being called? 
a. Base method
b. Derived method..

Ans. b

For the following C program
#define AREA(x)(3.14*x*x)
{float r1=6.25,r2=2.5,a;
printf("\n Area of the circle is %f", a);
printf("\n Area of the circle is %f", a);
What is the output?

Ans. Area of the circle is 122.656250
        Area of the circle is  19.625000

void main()
int d=5;

Ans: Undefined

void main()
int i;
case 1: printf("%d",i);break;
case 2:printf("%d",i);break;
case 3:printf("%d",i);break;
switch(i) case 4:printf("%d",i);

Ans: 1,2,3,4

void main()
char *s="\12345s\n";

Ans: 6

void main()
unsigned i=1; /* unsigned char k= -1 => k=255; */
signed j=-1; /* char k= -1 => k=65535 */
/* unsigned or signed int k= -1 =>k=65535 */

Ans: less

void main()
float j;

1. 1000000
2. Overflow
3. Error
4. None

Ans: 4

How do you declare an array of N pointers to functions returning  pointers to functions returning pointers to characters?

Ans: The first part of this question can be answered in at least
        three ways:

    1. char *(*(*a[N])())();

    2. Build the declaration up incrementally, using typedefs:

        typedef char *pc;    /* pointer to char */
        typedef pc fpc();    /* function returning pointer to char */
        typedef fpc *pfpc;    /* pointer to above */
        typedef pfpc fpfpc();    /* function returning... */
        typedef fpfpc *pfpfpc;    /* pointer to... */
        pfpfpc a[N];         /* array of... */

    3. Use the cdecl program, which turns English into C and vice

        cdecl> declare a as array of pointer to function returning
            pointer to function returning pointer to char
        char *(*(*a[])())()

    cdecl can also explain complicated declarations, help with
    casts, and indicate which set of parentheses the arguments
    go in (for complicated function definitions, like the one
    Any good book on C should explain how to read these complicated
    C declarations "inside out" to understand them ("declaration
    mimics use").
    The pointer-to-function declarations in the examples above have
    not included parameter type information. When the parameters
    have complicated types, declarations can *really* get messy.
    (Modern versions of cdecl can help here, too.)

Page Numbers :   1          2         3

Have a Question ? post your questions here. It will be answered as soon as possible.

Check C Aptitude Questions for more C Aptitude Interview Questions with Answers

Check Placement Papers for more IT Companies Paper