Q.1

Point out the error in the program?

typedef struct data mystruct;
struct data
{
    int x;
    mystruct *b;
};
  • Error: in structure declaration
  • Linker Error
  • No Error
  • None of above
Q.2

What will be the output of the program given below in 16-bit platform ?

#include<stdio.h>

int main()
{
    enum value{VAL1=VALVALVALVALvar;
    printf("%d\n", sizeof(var));
    return}
  • 1
  • 2
  • 4
  • 10
Q.3

Point out the error in the program?

struct emp
{
    int ecode;
    struct emp *e;
};
  • Error: in structure declaration
  • Linker Error
  • No Error
  • None of above
Q.4

Which of the following statements correct about the below program?

#include<stdio.h>

int main()
{
    struct emp
    {
        char name[25];
        int age;
        float sal;
    };
    struct emp e[2];
    int i=    for(i=i<i++)
        scanf("%s %d %f", e[i].name, &e[i].age, &e[i].sal);

    for(i=i<i++)
        scanf("%s %d %f", e[i].name, e[i].age, e[i].sal);
    return}
  • Error: scanf() function cannot be used for structures elements.
  • The code runs successfully.
  • Error: Floating point formats not linked Abnormal program termination.
  • Error: structure variable must be initialized.
Q.5

Which of the following statement is True?

  • User has to explicitly define the numeric value of enumerations
  • User has a control over the size of enumeration variables.
  • Enumeration can have an effect local to the block, if desired
  • Enumerations have a global effect throughout the file.
Q.6

Which of the following statements correct about the below program?

#include<stdio.h>

int main()
{
    union a
    {
        int i;
        char ch[2];
    };
    union a u1 = {512};
    union a u2 = {2};
    return
}
1: u2 CANNOT be initialized as shown.
2: u1 can be initialized as shown.
3: To initialize char ch[] of u2 '.' operator should be used.
4: The code causes an error 'Declaration syntax error'
  • 1, 2
  • 2, 3
  • 1, 2, 3
  • 1, 3, 4
Q.7

Point out the error in the program?

#include<stdio.h>
#include<string.h>
void modify(struct emp*);
struct emp
{
    char name[20];
    int age;
};
int main()
{
    struct emp e = {"Sanjay", 35};
    modify(&e);
    printf("%s %d", e.name, e.age);
    return}
void modify(struct emp *p)
{
     p ->age=p->age+}
  • Error: in structure
  • Error: in prototype declaration unknown struct emp
  • No error
  • None of above
Q.8

The '.' operator can be used access structure elements using a structure variable.

  • True
  • False
Q.9

Point out the error in the program?

#include<stdio.h>

int main()
{
    struct a
    {
        float category:        char scheme:    };
    printf("size=%d", sizeof(struct a));
    return}
  • Error: invalid structure member in printf
  • Error in this float category:5; statement
  • No error
  • None of above
Q.10

What will be the output of the program ?

#include<stdio.h>

int main()
{
    enum days {MON=-TUE, WED=THU, FRI, SAT};
    printf("%d, %d, %d, %d, %d, %d\n", ++MON, TUE, WED, THU, FRI, SAT);
    return
}
  • -1, 0, 1, 2, 3, 4
  • Error
  • 0, 1, 6, 3, 4, 5
  • 0, 0, 6, 7, 8, 9
Q.11

What will be the output of the program ?

#include<stdio.h>

int main()
{
    enum status {pass, fail, absent};
    enum status studstudstud
    stud1 = pass;
    stud2 = absent;
    stud3 = fail;
    printf("%d %d %d\n", studstudstud3);
    return
}
  • 0, 1, 2
  • 1, 2, 3
  • 0, 2, 1
  • 1, 3, 2
Q.12

Which of the following statements correctly assignsto month using pointer variable pdt?

#include<stdio.h>

    struct date
    {
        int day;
        int month;
        int year;
    };
int main()
{
    struct date d;
    struct date *pdt;
    pdt = &d;
    return}
  • pdt.month = 12
  • &pdt.month = 12
  • d.month = 12
  • pdt->month = 12
Q.13

Point out the error in the program in 16-bit platform?

#include<stdio.h>

int main()
{
    struct bits
    {
        int i:    }bit;

    printf("%d\n", sizeof(bit));
    return}
  • 4
  • 2
  • Error: Bit field too large
  • Error: Invalid member access in structure
Q.14

Union elements can be of different sizes.

  • True
  • False
Q.15

Point out the error in the program?

struct emp
{
    int ecode;
    struct emp e;
};
  • Error: in structure declaration
  • Linker Error
  • No Error
  • None of above
Q.16

What will be the output of the program ?

#include<stdio.h>

    struct course
    {
        int courseno;
        char coursename[25];
    };
int main()
{
    struct course c[] = { {"Java"}, 
                          {"PHP"}, 
                          {"DotNet"}     };

    printf("%d ", c[1].courseno);
    printf("%s\n", (*(c+2)).coursename);
    return}
  • 103 DotNet
  • 102 Java
  • 103 PHP
  • 104 DotNet
Q.17

What will be the output of the program ?

#include<stdio.h>

int main()
{
    int i=j=
    printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j);
    return
}
  • 12, 12, 12
  • 112, 1, 12
  • 32, 1, 12
  • -64, 1, 12
Q.18

Which of the following statements correct about the below code?
maruti.engine.bolts=25;

  • Structure bolts is nested within structure engine.
  • Structure engine is nested within structure maruti.
  • Structure maruti is nested within structure engine.
  • Structure maruti is nested within structure bolts.
Q.19

Point out the error in the program?

#include<stdio.h>

int main()
{
    union a
    {
        int i;
        char ch[2];
    };
    union a z1 = {512};
    union a z2 = {2};
    return}
  • Error: invalid union declaration
  • Error: in Initializing z2
  • No error
  • None of above
Q.20

A structure can contain similar or dissimilar elements

  • True
  • False
0 h : 0 m : 1 s