Aptitude Test in C Programming

download Aptitude Test in C Programming

of 6

Transcript of Aptitude Test in C Programming

  • 7/27/2019 Aptitude Test in C Programming

    1/6

    SDM INSTITUTE OF TECHNOLOGY, UJIRE

    Duration : 40 Mts C OBJECTIVE TEST

    Questions

    1. If the storage class is declared to be _________ then all the array elements would have a default initial

    value as zero.

    a) Dynamic b) Static c) new d) Auto

    2. Which of the storage class for only those variables that are being used by almost all the functions in the

    programa) Static b) Register c) Extern d) Auto

    3) The formatted functions allow the input read from the keyboard or the output displayed on the VDU

    True/False

    4) Execl is a

    a) Buffer manipulating functionb) Process Control function

    c) Time Related Function

    d) Directory Control Function

    5) Which of the follwing function repositions file pointer to a given location

    a) kbhit b) lseek c) ftell d) fscanf

    6) Which one of the arithmetic functions finds largest integer less than or equal to argument

    a) Cosh b) modf c) floor d) lileq

    7) memset implies

    a) Uses a given character to initialize a specified number of locations in the buffer.

    b) Uses a given character to initialize a specified number of lines in the memory.c)Uses a given character to initialize a specified number of byte in the buffer.

    d) Uses a given strings to initialize a specified number of byte in the buffer.

    8) Which of the following searches file if the file exists its contents are overwriten

    a) r+ b) w+ c) r d) a+

    9) #prgma pack

    a) is a directive specifies packing alignment for structure members.

    b) is a directive specifies packing alignment for record members.c) is a directive specifies packing alignment for pointers members.d) is a directive specifies packing misalignment for structure and record members.

  • 7/27/2019 Aptitude Test in C Programming

    2/6

    10) # include

    main(){

    int i,j

    for(i=1;i

  • 7/27/2019 Aptitude Test in C Programming

    3/6

  • 7/27/2019 Aptitude Test in C Programming

    4/6

    21.

    # include

    aaa() {printf("hi");

    }

    bbb(){printf("hello");

    }

    ccc(){printf("bye");

    }

    main()

    {int (*ptr[3])();

    ptr[0]=aaa;

    ptr[1]=bbb;

    ptr[2]=ccc;ptr[2]();

    }a)hihellobyebye b)hihellobye c)bye d)aaabbbcccbye

    22.struct point

    {

    int x;

    int y;};

    struct point origin,*pp;

    main(){

    pp=&origin;

    printf("origin is(%d%d)\n",(*pp).x,pp->y);}

    a)origin is(garbage values) b)variables not initialized

    c)origin is(0,0) d)none of these

    23. #define square(x) x*x

    main(){

    int i;

    i = 64/square(4);printf("%d",i);

    }

    a)4 b)64 c)16 d)256

  • 7/27/2019 Aptitude Test in C Programming

    5/6

    24. #include

    #define FUN(i,j) i##jvoid main() {

    int val1=10;

    int val12=20;printf(%d,FUN(val1,2)); }

    a) 10 b) 20 c) 1020 d) 12

    25.

    main() {

    int i=0;if(i++)

    main();

    {

    printf(f);exit(0);}

    main();}

    a)f b)f f f f f c)run time error d)compiler time error

    26.main()

    {

    char *p;

    int *q;long *r;

    p=q=r=0;

    p++;q++;

    r++;

    printf("%p...%p...%p",p,q,r);}

    a)000100010001 b)000100020004 c)111 d)compiler error

    27. What is the output of the program.main() {

    printf("%d\n", f(7));

    }f(int x)

    {

    if (x

  • 7/27/2019 Aptitude Test in C Programming

    6/6

    28. main() {

    int i;i = abc();

    printf("%d",i);

    }abc()

    {

    _AX = 1000;}

    a)1000 b) compiler error c)Garbage value d) none of these

    29. void main()

    {

    static int i=5;

    printf(%d,i--);if(i)

    main();}

    a)5 infinite times b)5 4 3 2 1 c)run time error d)unpredictable

    30.

    void main()

    {

    char a[]="12345\0";int i=strlen(a);

    printf("here in 3 %d\n",++i);

    }

    a)here in 3 5 b)here in 3 6 c)here in 3 7 d)none of these