Which of the following about the following two declaration is true i ) int *F() ii) int (*F)()
Both are identical
The first is a correct declaration and the second is wrong
The first declaraion is a function returning a pointer to an integer and the second is a pointer to function returning int
Both are different ways of declarin pointer to a function
What are the values printed by the following program?
#define dprint(expr) printf(#expr "=%d\n",expr)
main() { int x=7; int y=3; dprintf(x/y); }
#2 = 2
expr=2
x/y=2
None
Which of the following is true of the following program
main() { char *c; int *p; c =(char *)malloc(100); ip=(int *)c; free(ip); }
The code functions properly releasing all the memory allocated
Results in compilation error as pointer of various types cannot be equated
The program tries to alt
const
When an array is passed as parameter to a function, which of the following statement is correct
The function can change values in the original array
In C parameters are passed by value. The funciton cannot change the original value in the array
It results in compilation error when the function tries to access the elements in the array
Results in a run time error when the funtion tries to access the elements in the array
The type of the controlling expression of a switch statement cannot be of the type
int
char
short
float
Which is the output produced by the following program main() { int n=2; printf("%d %d\n", ++n, n*n); }
3,6
3,4
3,2
2,4
What is the output of the following program main() { int a=10; int b=6;
if(a=3) b++; printf("%d %d\n",a,b++); }
4,2
3,7
3,9
2,7
What can be said of the following program? main() { enum Months {JAN =1,FEB,MAR,APR}; Months X = JAN; if(X==1) { printf("Jan is the first month"); } }
Does not print anything
Prints : Jan is the first month
Generates compilation error
Results in runtime error
What is the output of the following program? main() { char *src = "Hello World"; char dst[100]; strcpy(src,dst); printf("%s",dst); } strcpy(char *dst,char *src) { while(*src) *dst++ = *src++; }
Hello World
Hello
World
Null
What is the output of the following program?
main() { int l=6; switch(l) { default : l+=2; case 4: l=4; case 5: l++; break; } printf("%d",l); }