Marks 1
What is printed by the following ANSI C program?
#include <stdio.h>
int main(int argc, char *argv[ ]) {
int x = 1, z[2] = {10, 11};
int ...
Consider the following C program :
#include < stdio.h >
int main () {
int arr [] = {1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip = arr+4;
...
Consider the following C program.
#include< stdio.h >
struct Ournode{
char x,y,z;
};
int main(){
struct Ournode p = {'1', '0', 'a'+2};
struct...
Consider the following C program
void f(int, short);
void main()
{
int i = 100;
short s = 12;
short *p = &s;
__________ ; // ca...
Consider the following C program.
#include < stdio.h >
void mystery(int *ptra, int *ptrb) {
int *temp;
temp = ptrb;
ptrb = ptra;...
The output of the following C program is__________.
void f1(int a, int b) {
int c;
c=a; a=b; b=c;
}
void f2(int *a, int *b) {
int c;
c=*a; *a=*...
What does the following fragment of C-program print?
char c[ ] = "GATE2011";
char *p = c;
printf("%s", p + p[3] - p[1]);
What does the following program print?
#include < stdio.h >
void f (int *p, int *q) {
p = q;
*p = 2;
}
int i = 0, j = 1;
int main ( ){
...
What does the following C statement declare?
int (*f)(int *);
Consider the following C function:
void swap (int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
In order to exchange the values of tw...
Assume the following C variable declaration
int * A[10], B[10][10];
Of the following expressions
I. A[2] II. A[2] [3] III. B[1] IV. B[2] [3]
Which wil...
The following C declarations
struct node{
int i:
float j;
};
struct node *s[10];
define s to be
The most appropriate matching for the following pairs
X: m=malloc(5); m= NULL;
Y: free(n); n->value = 5;
Z: char *p; *p='a';
1: using dangling
...
Consider the following C declaration
struct {
short s[5];
union {
float y;
long z;
} u;
}t;
Assume that objects of the t...
Marks 2
Consider the following C program:
#include < stdio.h >
int main()
{
int a[] = {2, 4, 6, 8, 10} ;
int ...
Consider the following C program:
#include< stdio.h >
void fun1(char *s1, char *s2){
char *tmp;
tmp = s1;
s1 = s2;
s2 = tmp;
}
void fun2...
What is the output of the following C code? Assume that the address of x is 2000 (in decimal) and an integer requires four bytes of memory.
int main (...
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{
static int a = 1; /* Line 1 */
prtFun();
a + = 1;
pr...
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{
static int a = 1; /* Line 1 */
prtFun();
a + = 1;
pr...
What is printed by the following C program?
#include < stdio.h >
int f(int x, int *py, int **ppz)
{
int y, z;
**ppz += 1;
z = **ppz;
...
Consider this C code to swap two integers and these five statements:
void swap(int *px, int *py)
{
*px = *px - *py;
*py = *px + *py;
*...
Consider the following C program segment:
char p[20];
char *s = "string";
int length = strlen(s);
for(i=0; i < length; i++)
p[i] = s[length-i];
p...
Consider the C program shown below.
#include < stdio.h >
#define print(x) printf("%d ", x)
int x;
void Q(int z) {
z += x; print(z);
}
void P(...
Consider the following three C functions:
[P1] int*g(void)
{
int x=10;
return(&x);
}
[P2] int*g(void)
{
int...
Marks 5
Consider the following C program:
void abc(char *s)
{
if(s[0]=='\0') return;
abc(s+1);
abc(s+1);
printf("%c",s[0]);
}
main()
{
abc("12...