1) Given the following statement
enum day = { jan = 1 ,feb=4, april, may}
What is the value of may?
2) Find the output for the following C program
main( )
{
int x, j, k;
j=k=6; x=2;
x=j*k;
printf("%d", x);
}
3) main( )
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
4) Find the output for the following C program
main( )
{
intx=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n", x,y);
}
5) Find the output for the following C program
main( )
{
int x=5;
printf("%d %d %d\n",x, x<<2,x>>2);
}
6) Find the output for the following C program
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main( )
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
//------------------------------
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
7) Find the output for the following C program
main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
8) Find the output for the following C program
#include< stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
9) Find the output for the following C program
#include< stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
10) The following variable is available in file1.c
static int average_float;
11) Find the output for the following C program
# define TRUE 0
some code
while(TRUE)
{
some code
}
12) Find the output for the following C program
main( )
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n" ,x ,y );
}
13) Find the output for the following C program
main( )
{
int a=0;
if(a=0) printf("Ramco Systems\n");
printf("Ramco Systems\n");
}
14) Display the Output
main( )
{
int x=2;
if(!x)
printf("Hello");
else
printf("Welcome");
}
15) Find the output for the below program
main( )
{
int x=10;
if(x==10);
printf("C programing");
printf("C tutor");
}
What is the value of may?
2) Find the output for the following C program
main( )
{
int x, j, k;
j=k=6; x=2;
x=j*k;
printf("%d", x);
}
3) main( )
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
4) Find the output for the following C program
main( )
{
intx=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n", x,y);
}
5) Find the output for the following C program
main( )
{
int x=5;
printf("%d %d %d\n",x, x<<2,x>>2);
}
6) Find the output for the following C program
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main( )
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
//------------------------------
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
7) Find the output for the following C program
main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
8) Find the output for the following C program
#include< stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
9) Find the output for the following C program
#include< stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
10) The following variable is available in file1.c
static int average_float;
11) Find the output for the following C program
# define TRUE 0
some code
while(TRUE)
{
some code
}
12) Find the output for the following C program
main( )
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n" ,x ,y );
}
13) Find the output for the following C program
main( )
{
int a=0;
if(a=0) printf("Ramco Systems\n");
printf("Ramco Systems\n");
}
14) Display the Output
main( )
{
int x=2;
if(!x)
printf("Hello");
else
printf("Welcome");
}
15) Find the output for the below program
main( )
{
int x=10;
if(x==10);
printf("C programing");
printf("C tutor");
}
Answers::::::::::::::::::::::::
1) 6
2) 36
3) An empty string
4) 57 , 94
5) 5 , 20, 1
6) 10, 5
7) Samco Systems
8) Compilation error giving it cannot be an modifiable 'Lvalue'
9) RamcoSystems
10) All the functions in the file1.c can access the variable
11) This won't go into the loop as TRUE is defined as 0
12) 11, 16
13) Ony one time "Ramco Systems" will be printed
14) Welcome
15) C programming, C tutor
2) 36
3) An empty string
4) 57 , 94
5) 5 , 20, 1
6) 10, 5
7) Samco Systems
8) Compilation error giving it cannot be an modifiable 'Lvalue'
9) RamcoSystems
10) All the functions in the file1.c can access the variable
11) This won't go into the loop as TRUE is defined as 0
12) 11, 16
13) Ony one time "Ramco Systems" will be printed
14) Welcome
15) C programming, C tutor
No comments:
Post a Comment