1.
What is the output of the following C code:
#include
typedef struct error {
    int warning, err, exception;
}
Error;
int main() {
    Error e;
    e.err = 1;
    printf("%d
", e.err);
}
2.
What does the following declaration signify:
void *cmp();
3.
What is the output of the following C code:
#include <stdio.h>
#define M(x, y) (x int main()
{
int x=3, y=4, z;
z = M(x+y/2, y-1);
if(z > 0)
printf("%d
", z);
}
4.
What is the output of the following C code:
#include <stdio.h>
#define S(a, b) int t; t=a, a=b, b=t;
int main()
{
int a=1, b=2;
S(a, b);
printf("%d,%d
", a, b);
}
5.
Assuming the size of the char is 1 byte and the pointer is 4 bytes, what is the output of the following C code:
#include <stdio.h>

int main()
{
char *a[2] = {"hel", "helo"};
printf("%d", sizeof(a));
return 0;
}
6.
In the following C program, the f function returns 1 only if ____________.
struct iter {
    int dat;
    struct iter * next;
};

int f(struct iter * p) {
    return ((p == NULL) || (p - > next == NULL) || ((p - > dat <= p - > next - > dat) && f(p - > next)));
}
7.
Consider the following C function:
1. The single-linked list of integers is taken as a parameter and the function rearranges the elements of the list
2. The function is called with the list containing the integers in the order: 1, 2, 3, 4, 5, 6, 7
3. What are the contents of the list after the function execution?
struct node { 
  int value;
    struct node * next;
};

void rearrange(struct node * list) {
    struct node * p, * q;
    int temp;
    if ((!list) || !list - > next)
        return;
    p = list;
    q = list - > next;
    while (q) {
        temp = p - > value;
        p - > value = q - > value;
        q - > value = temp;
        p = q - > next;
        q = p ? p - > next : 0;
    }
}
8.
How is an element inserted in the queue?
 
struct queue {
    int Q[20];
    int f, r;
}
Q;
++Q.Q[Q.r] = x;
9.
What is the output of the following C code:
 
#include

void main() {
    int i = 320;
    char * ptr = (char * ) & i;
    printf("%d", * ptr);
}
10.
What is the output of the following C code snippet:
 
#include

void main() {
    int h = 8;
    int b = h++ + h++ + h++;
    printf("%d
", h);
}