Q.1

What would be the equivalent pointer expression for referring the array element a[i][j][k][l]

  • ((((a+i)+j)+k)+l)
  • *(*(*(*(a+i)+j)+k)+l)
  • (((a+i)+j)+k+l)
  • ((a+i)+j+k+l)
Q.2

What is (void*)0?

  • Representation of NULL pointer
  • Representation of void pointer
  • Error
  • None of above
Q.3

What will be the output of the program?

#include<stdio.h>

int main()
{
    int arr[2][2][= {8};
    int *p, *q;
    p = &arr[1][1][1];
    q = (int*) arr;
    printf("%d, %d\n", *p, *q);
    return
}
  • 8, 10
  • 10, 2
  • 8, 1
  • Garbage values
Q.4

What will be the output of the program ?

#include<stdio.h>
#include<string.h>

int main()
{
    int i, n;
    char *x="Alice";
    n = strlen(x);
    *x = x[n];
    for(i=i<=n; i++)
    {
        printf("%s ", x);
        x++;
    }
    printf("\n", x);
    return}
  • Alice
  • ecilA
  • Alice lice ice ce e
  • lice ice ce e
Q.5

A pointer is

  • A keyword used to create variables
  • A variable that stores address of an instruction
  • A variable that stores address of other variable
  • All of the above
Q.6

Can you combine the following two statements into one?

char *p;
p = (char*) malloc(100);
  • char p = *malloc(100);
  • char *p = (char) malloc(100);
  • char *p = (char*)malloc(100);
  • char *p = (char *)(malloc*)(100);
Q.7

What will be the output of the program assuming that the array begins at the locationand size of an integer is 4 bytes?

#include<stdio.h>

int main()
{
    int a[3][= {};
    printf("%u, %u, %u\n", a[0]+*(a[0]+1), *(*(a+0)+1));
    return
}
  • 448, 4, 4
  • 520, 2, 2
  • 1006, 2, 2
  • Error
Q.8

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int i, a[] = {10};
    change(a, 5);
    for(i=i<=i++)
        printf("%d, ", a[i]);
    return}
void change(int *b, int n)
{
    int i;
    for(i=i<n; i++)
        *(b+= *(b+i)+}
  • 7, 9, 11, 13, 15
  • 2, 15, 6, 8, 10
  • 2 4 6 8 10
  • 3, 1, -1, -3, -5
Q.9

What will be the output of the program ?

#include<stdio.h>

void fun(void *p);
int i;

int main()
{
    void *vptr;
    vptr = &i;
    fun(vptr);
    return
}
void fun(void *p)
{
    int **q;
    q = (int**)&p;
    printf("%d\n", **q);
}
  • Error: cannot convert from void** to int**
  • Garbage value
  • 0
  • No output
Q.10

The operator used to get value at address stored in a pointer variable is

  • *
  • &
  • &&
  • ||
Q.11

In which header file is the NULL macro defined?

  • stdio.h
  • stddef.h
  • stdio.h and stddef.h
  • math.h
Q.12

What will be the output of the program?

#include<stdio.h>

int main()
{
    int arr[= {4};
    char *p;
    p = arr;
    p = (char*)((int*)(p));
    printf("%d, ", *p);
    p = (int*)(p+1);
    printf("%d", *p);
    return
}
  • 2, 3
  • 2, 0
  • 2, Garbage value
  • 0, 0
Q.13

If the size of integer is 4bytes, What will be the output of the program?

#include<stdio.h>

int main()
{
    int arr[] = {16};
    printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0]));
    return}
  • 10, 2, 4
  • 20, 4, 4
  • 16, 2, 2
  • 20, 2, 2
Q.14

What will be the output of the program ?

#include<stdio.h>

int main()
{
    char *str;
    str = "%s";
    printf(str, "K\n");
    return}
  • Error
  • No output
  • K
  • %s
Q.15

How many bytes are occupied by near, far and huge pointers (DOS)?

  • near=2 far=4 huge=4
  • near=4 far=8 huge=8
  • near=2 far=4 huge=8
  • near=4 far=4 huge=8
Q.16

What will be the output of the program ?

#include<stdio.h>

int main()
{
    char *str;
    str = "%d\n";
    str++;
    str++;
    printf(str-300);
    return}
  • No output
  • 30
  • 3
  • 300
Q.17

What will be the output of the program ?

#include<stdio.h>
int *check(static int, static int);

int main()
{
    int *c;
    c = check(20);
    printf("%d\n", c);
    return}
int *check(static int i, static int j)
{
    int *p, *q;
    p = &i;
    q = &j;
    if(i >=        return (p);
    else
        return (q);
}
  • 10
  • 20
  • Error: Non portable pointer conversion
  • Error: cannot use static for function parameters
Q.18

What will be the output of the program ?

#include<stdio.h>

int main()
{
    char str[] = "peace";
    char *s = str;
    printf("%s\n", s++ +3);
    return}
  • peace
  • eace
  • ace
  • ce
Q.19

What will be the output of the program ?

#include<stdio.h>

int main()
{
    static char *s[] = {"black", "white", "pink", "violet"};
    char **ptr[] = {s+s+s+s}, ***p;
    p = ptr;
    ++p;
    printf("%s", **p+1);
    return}
  • ink
  • ack
  • ite
  • let
Q.20

Point out the compile time error in the program given below.

#include<stdio.h>

int main()
{
    int *x;
    *x=    return}
  • Error: invalid assignment for x
  • Error: suspicious pointer conversion
  • No error
  • None of above
0 h : 0 m : 1 s