1.What is the output of the program
#include <stdio.h>
void main()
{
struct a
{
char ch[10];
char *str;
};
struct a s1={" Hyderabad "," Bangalore "};
printf("\n%c%c",s1.ch[0],*s1.str);
printf("\n%s%s",s1.ch,s1.str);
getch();
}
2.What is the output of the program
#include <stdio.h>
int main(int argc,int *argv[])
{
int i;
for(i=1;i<argc; i++)
printf("%s",argv[i]);
return 0;
getch();
}
//file oracle.c
//command to run oracle i work for oracle
3.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k;
for(i=0;i<3;i++)
k=sum(i,i);
printf("\n%d",k);
getch();
}
int sum(int s,int t)
{
static int m;
m+=s+t;
return m;
}
4.What is the output of the program
#include <stdio.h>
void main()
{
int i;
clrscr();
for(i=1;i<6;++i)
switch(i)
{
case 1:
case 2: printf("%d,",i++);break;
case 3: continue;
case 4: printf("%d,",i);
}
printf("%d",i);
getch();
}
5.Which of the storage classes is global variables for the entire Program
a) extern b) static c) auto d) register
6.What is the output of the program
#include <stdio.h>
void main()
{
char s[]="oracle is the best";
char t[40];
char *ss,*tt;
while(*tt++=*ss++);
printf("%s",t);
getch();
}
a) oracle is the best b) Core dump
c) Error d) Goes into infinite loop
7.What is the output of the program
#include <stdio.h>
void main()
{
int j[10]={9,7,5,3,1,2,4,6,9};
int i=1;
clrscr();
for(;i<9;i++)
printf("%d ",--j[i++]);
getch();
}
a) 6 2 1 5 b) 6 2 1 5 7 c) Error d)core dump
8.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k,n=5;
clrscr();
for(i=5;i>0;i--)
{
j=1
k=n&j;
k==0?printf("0"):printf("1");
}
getch();
}
a) 00011 b) 11110 c) 11001 d) 11100
9.What is the output of the program, if integer occupies 2 bytes memory?
#include <stdio.h>
union
{
int a;
char b;
char c[10];
}u1;
void main()
{
int l=sizeof(u1);
printf("%d",l);
getch();
}
a) 13 b) 10 c)16 d) None of the above
10.What is the output of the program
#include <stdio.h>
void main()
{
fork();
printf(" Hello World");
getch();
}
a) Hello World d) Hello World Hello World
c) Error Message d) None of these
11.What is the output of the program
#include <stdio.h>
void main()
{
struct a
{
int i;
char *st1;
};
typedef struct a ST;
ST *str1;
str1=(ST*)malloc(100);
str1->i=100;
strcpy(str1->st1,"Welcome to Oracle");
printf(" %d%s\n",str1->i,str1->st1);
getch();
}
a) core dump b) will not compile
c) 100,Welcome to Oracle d) None of these
12.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k;
i=2;
j=4;
k=i++>j&2;
printf("%d\n",k);
if(++k && ++i<--j|| i++)
{
j=++k;
}
printf(" %d %d %d",i,-j--,k);
getch();
}
a) 4,-3,2 b) 5,-3,2 c. c)4,-2,2 d)5,-2,2
13.Which of the following is not true in case of Command line arguments
a). The argc parameter is used to hold the number of arguments in the = command line and is an integer
b). The argv parameter is a pointer to an array of a character = pointer and each one points to command line arguments
c). The argv[1] always point to program name
d). None of above
14.What is the value of x?
#include<stdio.h>
#define sqr(x) (x*x)
int main()
{
int x=2;
printf("value of x=%d",sqr(x+1));
}
a)4 b)5 c) None d) can not compile
15. what is the wrong in the following program?
#define LBRACKET {
#define RBRACKET }
#define MAIN main
int MAIN()
LBRACKET
int x=2;
printf("%d",x);
RBRACKET
a) This program will compile b) compilation error
16.What is the output of the program
#include <stdio.h>
int main()
{
int x=4;
{
int x=2;
printf("%d",x);
}
}
a) 4 b)2 c) Nesting not allowed d) dependent on the compiler
17. Go through the following code snippet
char a[20];
a="Hello Orcale Test"; will this code compile?
a) Compilation Error b) Hello Oracle Test
c) dependent on compiler d) will work fine.
18. The expression a+b*c should be conveted to +a*bc.
Using tree structure, which traversal is the correct one?
a) Postfix traversal b) prefix traversal c) infix traversal d)None
19. what about brk, sbrk.
a) system calls b) function calls c) user defined functions
20. Why the use of alloca() is discouraged?
21. Macros support multiple arguments?
22. The header file
a) contains only compiler directives and extern variables
b) contain only structures and union
c) a & b d) None
Continue>>
#include <stdio.h>
void main()
{
struct a
{
char ch[10];
char *str;
};
struct a s1={" Hyderabad "," Bangalore "};
printf("\n%c%c",s1.ch[0],*s1.str);
printf("\n%s%s",s1.ch,s1.str);
getch();
}
2.What is the output of the program
#include <stdio.h>
int main(int argc,int *argv[])
{
int i;
for(i=1;i<argc; i++)
printf("%s",argv[i]);
return 0;
getch();
}
//file oracle.c
//command to run oracle i work for oracle
3.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k;
for(i=0;i<3;i++)
k=sum(i,i);
printf("\n%d",k);
getch();
}
int sum(int s,int t)
{
static int m;
m+=s+t;
return m;
}
4.What is the output of the program
#include <stdio.h>
void main()
{
int i;
clrscr();
for(i=1;i<6;++i)
switch(i)
{
case 1:
case 2: printf("%d,",i++);break;
case 3: continue;
case 4: printf("%d,",i);
}
printf("%d",i);
getch();
}
5.Which of the storage classes is global variables for the entire Program
a) extern b) static c) auto d) register
6.What is the output of the program
#include <stdio.h>
void main()
{
char s[]="oracle is the best";
char t[40];
char *ss,*tt;
while(*tt++=*ss++);
printf("%s",t);
getch();
}
a) oracle is the best b) Core dump
c) Error d) Goes into infinite loop
7.What is the output of the program
#include <stdio.h>
void main()
{
int j[10]={9,7,5,3,1,2,4,6,9};
int i=1;
clrscr();
for(;i<9;i++)
printf("%d ",--j[i++]);
getch();
}
a) 6 2 1 5 b) 6 2 1 5 7 c) Error d)core dump
8.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k,n=5;
clrscr();
for(i=5;i>0;i--)
{
j=1
k=n&j;
k==0?printf("0"):printf("1");
}
getch();
}
a) 00011 b) 11110 c) 11001 d) 11100
9.What is the output of the program, if integer occupies 2 bytes memory?
#include <stdio.h>
union
{
int a;
char b;
char c[10];
}u1;
void main()
{
int l=sizeof(u1);
printf("%d",l);
getch();
}
a) 13 b) 10 c)16 d) None of the above
10.What is the output of the program
#include <stdio.h>
void main()
{
fork();
printf(" Hello World");
getch();
}
a) Hello World d) Hello World Hello World
c) Error Message d) None of these
11.What is the output of the program
#include <stdio.h>
void main()
{
struct a
{
int i;
char *st1;
};
typedef struct a ST;
ST *str1;
str1=(ST*)malloc(100);
str1->i=100;
strcpy(str1->st1,"Welcome to Oracle");
printf(" %d%s\n",str1->i,str1->st1);
getch();
}
a) core dump b) will not compile
c) 100,Welcome to Oracle d) None of these
12.What is the output of the program
#include <stdio.h>
void main()
{
int i,j,k;
i=2;
j=4;
k=i++>j&2;
printf("%d\n",k);
if(++k && ++i<--j|| i++)
{
j=++k;
}
printf(" %d %d %d",i,-j--,k);
getch();
}
a) 4,-3,2 b) 5,-3,2 c. c)4,-2,2 d)5,-2,2
13.Which of the following is not true in case of Command line arguments
a). The argc parameter is used to hold the number of arguments in the = command line and is an integer
b). The argv parameter is a pointer to an array of a character = pointer and each one points to command line arguments
c). The argv[1] always point to program name
d). None of above
14.What is the value of x?
#include<stdio.h>
#define sqr(x) (x*x)
int main()
{
int x=2;
printf("value of x=%d",sqr(x+1));
}
a)4 b)5 c) None d) can not compile
15. what is the wrong in the following program?
#define LBRACKET {
#define RBRACKET }
#define MAIN main
int MAIN()
LBRACKET
int x=2;
printf("%d",x);
RBRACKET
a) This program will compile b) compilation error
16.What is the output of the program
#include <stdio.h>
int main()
{
int x=4;
{
int x=2;
printf("%d",x);
}
}
a) 4 b)2 c) Nesting not allowed d) dependent on the compiler
17. Go through the following code snippet
char a[20];
a="Hello Orcale Test"; will this code compile?
a) Compilation Error b) Hello Oracle Test
c) dependent on compiler d) will work fine.
18. The expression a+b*c should be conveted to +a*bc.
Using tree structure, which traversal is the correct one?
a) Postfix traversal b) prefix traversal c) infix traversal d)None
19. what about brk, sbrk.
a) system calls b) function calls c) user defined functions
20. Why the use of alloca() is discouraged?
21. Macros support multiple arguments?
22. The header file
a) contains only compiler directives and extern variables
b) contain only structures and union
c) a & b d) None
Continue>>