Q.1

Identify which of the following are declarations

1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);
  • 1
  • 2
  • 1 and 3
  • 3
Q.2

Is there any difference between following declarations?

1 : extern int fun();
2 : int fun();
  • Both are identical
  • No difference, except extern int fun(); is probably in another file
  • int fun(); is overrided with extern int fun();
  • None of these
Q.3

What is the output of the program

#include<stdio.h>
int main()
{
    struct emp
    {
        char name[20];
        int age;
        float sal;
    };
    struct emp e = {"Tiger"};
    printf("%d, %f\n", e.age, e.sal);
    return
}
  • 0, 0.000000
  • Garbage values
  • Error
  • None of above
Q.4

In the following program where is the variable a getting defined and where it is getting declared?

#include<stdio.h>
int main()
{
    extern int a;
    printf("%d\n", a);
    return}
int a=
  • extern int a is declaration, int a = 20 is the definition
  • int a = 20 is declaration, extern int a is the definition
  • int a = 20 is definition, a is not defined
  • a is declared, a is not defined
Q.5

How would you round off a value from 1.to 2.0?

  • ceil(1.66)
  • floor(1.66)
  • roundup(1.66)
  • roundto(1.66)
Q.6

What is the output of the program?

#include<stdio.h>
int main()
{
    union a
    {
        int i;
        char ch[2];
    };
    union a u;
    u.ch[=    u.ch[=    printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i);
    return}
  • 3, 2, 515
  • 515, 2, 3
  • 3, 2, 5
  • None of these
0 h : 0 m : 1 s