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:earnestly believe that you will visit our relatives during your forthcoming trip to Mumbai.

A could not believe

B certainly believing that

C No correction required

D had hardly believe that

E sincerely would believe

Q2: Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    struct ex
    {
        int i;
        float j;
        char *s
    };
    struct ex *p;
    p = (struct ex *)malloc(sizeof(struct ex));
    p->s = (char*)malloc(20);
    return 0;
}

A free(p);

B free(p->s); , free(p);

C free(p->s);

D free(p); , free(p->s);

Q3: Point out the correct statement which correctly allocates memory dynamically for 2D array following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int *p, i, j;
    /* Add statement here */
    for(i=0; i<3; i++)
    {
        for(j=0; j<4; j++)
        {
            p[i*4+j] = i;
            printf('%d', p[i*4+j]);
        }
    }
    return 0;
}

A p = (int*) malloc(3*sizeof(int));

B p = (int*) malloc(3*4*sizeof(int));

C p = (int*) malloc(3, 4);

D p = malloc(3*4*sizeof(int));

Q4:
malloc() returns a float pointer if memory is allocated for storing float's and a double pointer if memory is allocated for storing double's.

A False

B True

Q5:
malloc() allocates memory from the heap and not from the stack.

A True

B False

Q6:
malloc() returns a NULL if it fails to allocate the requested memory.

A False

B True

Q7:
If malloc() successfully allocates memory it returns the number of bytes it has allocated.

A True

B False

Q8: Can I increase the size of dynamically allocated array?

A Yes

B No

Q9: Can I increase the size of statically allocated array?

A Yes

B No

Q10: Declare the following statement? "An array of three pointers to chars".

A
char (*ptr[3])();

B
char **ptr[3];

C
char *ptr[3]();

D
char *ptr[3];

E
char *ptr[3];