You are on page 1of 2

1)

Which is a good way of representing variables in recursion


a) local variables
b) static varaibles
c) global variables
*****************************
2)
a=0;
while(a<5)
printf("%d\n",a++);
How many times does the loop occurs?
*****************************
3)What is the memory allocated in the following?
a) int (*p)[10]
b) int (*p)()
*****************************
4)
Arrange in the order of precendence:
logical,unary,arithmetic,assignment,relational,conditional operators
*****************************
5)
Write programs for the following problems in C.
1. Swap two variables x,y without using a temporary variable.
2. Write algorithm for finding the GCD of a number.
3.Write a program for reversing the given string.
4. The integers from 1 to n are stored in an array in a random
fashion. but one integer is missing. Write a program to find the
missing integer
*****************************
6)
int i;
for(i=1;i<4,i++)
switch(i)
{
case 1: printf("%d",i);
case 2:printf("%d",i);
case 3:printf("%d",i);
}
switch(i) case 4:printf("%d",i);
*****************************
7)
void main()
{
char *s="\12345s\n";
printf("%d",strlen(s));
}
*****************************
8)
void main()
{
char *s[]={ "dharma","hewlett-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("%s",*p++);
printf("%s",++*p);
}
*****************************

9)
int i=3,j=2;
float f=i/j;
printf("%f",f);
*****************************
10)
void main()
{int i,x,sum=0;
int arr[6]=[1,2,3,4,5,6]
for (i=0;i<4;i++)
sum+ = func(arr[i]);
printf("%d", sum);
}
func(int x)
{ int val;
val = 2;
return(x+ val++);
}
*****************************
11)
a) Shall we call main() function recursively?
b)How does C pass variables to a function ?
*****************************
12)
#define scanf "%s is a string"
main()
{ printf(scanf,scanf);
}
*****************************
13)
printf("%u",-1);
*****************************

You might also like