image not found

Oops! That page can't be found.


Directions to Solve

Which of phrases given below each sentence should replace the phrase printed in bold type to make the grammatically correct? If the sentence is correct as it is, mark 'E' as the answer.

Q1: As there was no time, the remaining items were deferred into the next meeting.

A are deferred till

B were deferred till

C were deferred to

D had deferred with

E No correction required

Q2: Which of the statements is correct about the program?
#include<stdio.h>

int main()
{
    float a=3.14;
    char *j;
    j = (char*)&a;
    printf("%d\n", *j);
    return 0;
}

A It will print a garbage value

B It prints ASCII value of the binary number present in the first byte of a float variable a.

C It will print 3

D It prints character equivalent of the binary number present in the first byte of a float variable a.

Q3: In the following program add a statement in the function fun() such that address of a gets stored in j?
#include<stdio.h>
int main()
{
    int *j;
    void fun(int**);
    fun(&j);
    return 0;
}
void fun(int **k)
{
    int a=10;
    /* Add a statement here */
}

A *k=&a

B &k=*a

C **k=a;

D k=&a;

Q4: Which of the following statements correct about k used in the below statement?
char ****k;

A k is a pointer to a pointer to a pointer to a pointer to a char

B k is a pointer to a pointer to a pointer to a char

C k is a pointer to a char pointer

D k is a pointer to a pointer to a char

Q5: Which of the statements is correct about the program?
#include<stdio.h>

int main()
{
    int arr[3][3] = {1, 2, 3, 4};
    printf("%d\n", *(*(*(arr))));
    return 0;
}

A Output: Garbage value

B Output: 1

C Output: 3

D Error: Invalid indirection

Q6: Which statement will you add to the following program to ensure that the program outputs "AptitudeCrack" on execution?
#include<stdio.h>

int main()
{
    char s[] = "AptitudeCrack";
    char t[25];
    char *ps, *pt;
    ps = s;
    pt = t;
    while(*ps)
        *pt++ = *ps++;

    /* Add a statement here */
    printf("%s\n", t);
    return 0;
}

A pt='\0';

B *pt='';

C *pt='\0';

D pt='\n';

Q7: In the following program add a statement in the function fact() such that the factorial gets stored in j.
#include<stdio.h>
void fact(int*);

int main()
{
    int i=5;
    fact(&i);
    printf("%d\n", i);
    return 0;
}
void fact(int *j)
{
    static int s=1;
    if(*j!=0)
    {
        s = s**j;
        *j = *j-1;
        fact(j);
        /* Add a statement here */
    }
}

A j=s;

B *j=&s;

C *j=s;

D &j=s;

Q8:
Are the expression *ptr++ and ++*ptr are same?

A False

B True

Q9: Will the program compile?
#include<stdio.h>
int main()
{
    char str[5] = "AptitudeCrack";
    return 0;
}

A False

B True

Q10: The following program reports an error on compilation.
#include<stdio.h>
int main()
{
    float i=10, *j;
    void *k;
    k=&i;
    j=k;
    printf("%f\n", *j);
    return 0;
}

A False

B True