Q.1

Point out the error in the program.

#include<stdio.h>

int main()
{
    const int k=    int *const q=&k;
    printf("%d", *q);
    return}
  • Error: RValue required
  • Error: Lvalue required
  • Error: cannot convert from 'const int *' to 'int *const'
  • No error
Q.2

Point out the error in the program.

#include<stdio.h>
#define MAX
int main()
{
    char mybuf[] = "India";
    char yourbuf[] = "BIX";
    char *const ptr = mybuf;
    *ptr = 'a';
    ptr = yourbuf;
    return}
  • Error: unknown pointer conversion
  • Error: cannot convert ptr const value
  • No error
  • None of above
Q.3

Point out the error in the program.

#include<stdio.h>
#define MAX
int main()
{
    char mybuf[] = "India";
    char yourbuf[] = "BIX";
    char const *ptr = mybuf;
    *ptr = 'a';
    ptr = yourbuf;
    return}
  • Error: cannot convert ptr const value
  • Error: unknown pointer conversion
  • No error
  • None of above
Q.4

Point out the error in the program (in Turbo-C).

#include<stdio.h>
#define MAX
int main()
{
    const int max=    char array[max];
    char string[MAX];
    array[= string[= 'A';
    printf("%c %c\n", array[0], string[0]);
    return}
  • Error: unknown max in declaration/Constant expression required
  • Error: invalid array string
  • None of above
  • No error. It prints A A
Q.5

Point out the error in the program.

#include<stdio.h>
const char *fun();

int main()
{
    *fun() = 'A';
    return}
const char *fun()
{
    return "Hello";
}
  • Error: RValue required
  • Error: Lvalue required
  • Error: fun() returns a pointer const character which cannot be modified
  • No error
Q.6

Point out the error in the program.

#include<stdio.h>
#include<stdlib.h>

union employee
{
    char name[15];
    int age;
    float salary;
};
const union employee e
int main()
{
    strcpy(e1.name, "K");
    printf("%s", e1.name);    
    e1.age=    printf("%d", e1.age);
    printf("%f", e1.salary);
    return}
  • Error: RValue required
  • Error: cannot modify const object
  • Error: LValue required in strcpy
  • No error
Q.7

Point out the error in the program.

#include<stdio.h>
const char *fun();

int main()
{
    char *ptr = fun();
    return}
const char *fun()
{
    return "Hello";
}
  • Error: Lvalue required
  • Error: cannot convert 'const char *' to 'char *'.
  • No error and No output
  • None of above
Q.8

Point out the error in the program.

#include<stdio.h>

int main()
{
    const int x;
    x=    printf("%d\n", x);
    return}
  • Error: unknown data type const int
  • Error: const variable have been initialised when declared.
  • Error: stack overflow in x
  • No error
Q.9

What will be the output of the program?

#include<stdio.h>

int main()
{
    const char *s = "";
    char str[] = "Hello";
    s = str;
    while(*s)
        printf("%c", *s++);

    return}
  • Error
  • H
  • Hello
  • Hel
Q.10

What will be the output of the program?

#include<stdio.h>

int main()
{
    int y=    const int x=y;
    printf("%d\n", x);
    return}
  • 128
  • Garbage value
  • Error
  • 0
Q.11

What will be the output of the program?

#include<stdio.h>
int get();

int main()
{
    const int x = get();
    printf("%d", x);
    return}
int get()
{
    return}
  • Garbage value
  • Error
  • 20
  • 0
Q.12

What will be the output of the program?

#include<stdio.h>
#include<stdlib.h>

union employee
{
    char name[15];
    int age;
    float salary;
};
const union employee e
int main()
{
    strcpy(e1.name, "K");
    printf("%s %d %f", e1.name, e1.age, e1.salary);
    return}
  • Error: RValue required
  • Error: cannot convert from 'const int *' to 'int *const'
  • Error: LValue required in strcpy
  • No error
Q.13

What will be the output of the program (in Turbo C)?

#include<stdio.h>

int fun(int *f)
{
    *f =    return}
int main()
{
    const int arr[= {5};
    printf("Before modification arr[= %d", arr[3]);
    fun(&arr[3]);
    printf("\nAfter modification arr[= %d", arr[3]);
    return}
  • Before modification arr[3] = 4
    After modification arr[3] = 10
  • Error: cannot convert parameter 1 from const int * to int *
  • Error: Invalid parameter
  • Before modification arr[3] = 4
    After modification arr[3] = 4
Q.14

What will be the output of the program?

#include<stdio.h>
int fun(int **ptr);

int main()
{
    int i=    const int *ptr = &i;
    fun(&ptr);
    return}
int fun(int **ptr)
{
    int j =    int *temp = &j;
    printf("Before changing ptr = %5x\n", *ptr);
    const *ptr = temp;
    printf("After changing ptr = %5x\n", *ptr);
    return}
  • Address of i
    Address of j
  • 10
    223
  • Error: cannot convert parameter 1 from 'const int **' to 'int **'
  • Garbage value
Q.15

What will be the output of the program?

#include<stdio.h>

int main()
{
    const int i=    printf("%d\n", i++);
    return}
  • 10
  • 11
  • No output
  • Error: ++needs a value
Q.16

What will be the output of the program?

#include<stdio.h>

int main()
{
    const int x=    const int *ptrx;
    ptrx = &x;
    *ptrx =    printf("%d\n", x);
    return}
  • 5
  • 10
  • Error
  • Garbage value
Q.17

What will be the output of the program?

#include<stdio.h>

int main()
{
    const c = -
    const int d =
    printf("%d, %d\n", c, d);
    return
}
  • Error
  • -11, 34
  • 11, 34
  • None of these
Q.18

What will be the output of the program in TurboC?

#include<stdio.h>
int fun(int **ptr);

int main()
{
    int i=j=    const int *ptr = &i;
    printf(" i = %5X", ptr);
    printf(" ptr = %d", *ptr);
    ptr = &j;
    printf(" j = %5X", ptr);
    printf(" ptr = %d", *ptr);
    return}
  • i= FFE2 ptr=12 j=FFE4 ptr=24
  • i= FFE4 ptr=10 j=FFE2 ptr=20
  • i= FFE0 ptr=20 j=FFE1 ptr=30
  • Garbage value
0 h : 0 m : 1 s