Q.1

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct emp
    {
        char name[20];
        float sal;
    };
    struct emp e[10];
    int i;
    for(i=i<=i++)
        scanf("%s %f", e[i].name, &e[i].sal);
    return}
  • Error: invalid structure member
  • Error: Floating point formats not linked
  • No error
  • None of above
Q.2

How will you free the allocated memory ?

  • remove(var-name);
  • free(var-name);
  • delete(var-name);
  • dalloc(var-name);
Q.3

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct emp
    {
        char name[25];
        int age;
        float bs;
    };
    struct emp e;
    e.name = "Suresh";
    e.age =    printf("%s %d\n", e.name, e.age);
    return}
  • Error: Lvalue required/incompatible types in assignment
  • Error: invalid constant expression
  • Error: Rvalue required
  • No error, Output: Suresh 25
Q.4

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

#include<stdio.h>

int main()
{
    struct emp
    {
        char *n;
        int age;
    };
    struct emp e1 = {"Dravid", 23};
    struct emp e2 = e    strupr(e2.n);
    printf("%s\n", e1.n);
    return}
  • Error: Invalid structure assignment
  • DRAVID
  • Dravid
  • No output
Q.5

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct emp
    {
        char n[20];
        int age;
    };
    struct emp e1 = {"Dravid", 23};
    struct emp e2 = e    if(e1 == e        printf("The structure are equal");
    return}
  • Prints: The structure are equal
  • Error: Structure cannot be compared using '=='
  • No output
  • None of above
Q.6

The '->' operator can be used to access structures elements using a pointer to a structure variable only

  • True
  • False
Q.7

What is the similarity between a structure, union and enumeration?

  • All of them let you define new values
  • All of them let you define new data types
  • All of them let you define new pointers
  • All of them let you define new structures
Q.8

What will be the output of the program in 16-bit platform (under DOS)?

#include<stdio.h>

int main()
{
    struct node
    {
        int data;
        struct node *link;
    };
    struct node *p, *q;
    p = (struct node *) malloc(sizeof(struct node));
    q = (struct node *) malloc(sizeof(struct node));
    printf("%d, %d\n", sizeof(p), sizeof(q));
    return}
  • 2, 2
  • 8, 8
  • 5, 5
  • 4, 4
Q.9

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct bits
    {
        float f:    }bit;

    printf("%d\n", sizeof(bit));
    return}
  • 4
  • 2
  • Error: cannot set bit field for float
  • Error: Invalid member access in structure
Q.10

It is not possible to create an array of pointer to structures.

  • True
  • False
Q.11

A union cannot be nested in a structure

  • True
  • False
Q.12

Can a structure can point to itself?

  • Yes
  • No
Q.13

Is there easy way to print enumeration values symbolically?

  • Yes
  • No
Q.14

If the following structure is written to a file using fwrite(), can fread() read it back successfully?

struct emp
{
    char *n;
    int age;
};
struct emp e={"IndiaBIX", 15};
FILE *fp;
fwrite(&e, sizeof(e),fp);
  • Yes
  • No
Q.15

What will be the output of the program ?

#include<stdio.h>

int main()
{
    union var
    {
        int a, b;
    };
    union var v;
    v.a=    v.b=    printf("%d\n", v.a);
    return}
  • 10
  • 20
  • 30
  • 0
Q.16

What will be the output of the program ?

#include<stdio.h>

int main()
{
    struct byte
    {
        int one:    };
    struct byte var = {1};
    printf("%d\n", var.one);
    return}
  • 1
  • -1
  • 0
  • Error
Q.17

What will be the output of the program ?

#include<stdio.h>

int main()
{
    union var
    {
        int a, b;
    };
    union var v;
    v.a=    v.b=    printf("%d\n", v.a);
    return}
  • 10
  • 20
  • 30
  • 0
Q.18

Nested unions are allowed

  • True
  • False
Q.19

If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?

struct ex
{
    char ch;
    int i;
    long int a;
};
  • Yes
  • No
Q.20

By default structure variable will be of auto storage class

  • Yes
  • No
0 h : 0 m : 1 s