Questions on C :: Part - 2
Posted by Subash | 8:39 PM
[3] Comments
- Write a program to reverse a linked list.
- char a =0xAA ;
int b ;
b = (int) a ;
b = b >> 4 ;
printf("%x",b);
What is the output of the above program segment ? - struct s1 { struct { struct { int x; } s2 } s3 }y;
How does one access x in the above given structure definition ? - What is the worst case complexity of Quick sort?
Ans. O(n2) - What is the size of the array declared as double * X[5] ?
Ans. 5 * sizeof ( double * ) - void f(int y)
{
struct s *ptr;
ptr = malloc (sizeof (struct)+99*sizeof(int));
}
struct s{
int i;
float p;
};
when free (ptr) is executed, then what will happen? - Swap two variables x,y without using a temporary variabl
- Write algorithm for finding the GCD of a number.
- Write a program for reversing the given string.
- For the following C program
#define AND &&
#define ARRANGE (a>25 AND a<50)
main()
{int a = 30;
if (ARRANGE)
printf("within range");
else
printf("out of range");
}What is the output?
- For the following C program
#define AREA(x)(3.14*x*x)
main()
{float r1=6.25,r2=2.5,a;
a=AREA(r1);
printf("\n Area of the circle is %f", a);
a=AREA(r2);
printf("\n Area of the circle is %f", a);
}What is the output?
Ans. Area of the circle is 122.656250
Area of the circle is 19.625000 - Write a C program that reverses the linked list.
12:19 PM
#6: sizeof(struct) is meaningless. you're not specifying which struct.
12:19 PM
#8: GCD is the greatest common denominator of two numbers
11:16 PM
q-p=500
please, explain sir