Friday, November 13, 2009

HCL Question Paper

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");
}

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I Found E-Tutorial, E-Learning and Job on www.hub4tech.com. This portal is excellent for Technical Skills Development and jobs.This Portal is also provide Online test paper

    ReplyDelete