x = 3, counter = 0;
while ((x-1))
{
++counter;
x--;
}
Choice a: 0
Choice b: 1
Choice c: 2
Choice d: 3
Choice e: 4
Saturday, November 29, 2008
Predict the output of following programme
void myFunc (int x)
{
if (x > 0)
myFunc(--x);
printf("%d, ", x);
}
int main()
{
myFunc(5);
return 0;
}
Choice a: 1, 2, 3, 4, 5, 5,
Choice b: 4, 3, 2, 1, 0, 0,
Choice c: 5, 4, 3, 2, 1, 0,
Choice d: 0, 0, 1, 2, 3, 4,
Choice e: 0, 1, 2, 3, 4, 5,
{
if (x > 0)
myFunc(--x);
printf("%d, ", x);
}
int main()
{
myFunc(5);
return 0;
}
Choice a: 1, 2, 3, 4, 5, 5,
Choice b: 4, 3, 2, 1, 0, 0,
Choice c: 5, 4, 3, 2, 1, 0,
Choice d: 0, 0, 1, 2, 3, 4,
Choice e: 0, 1, 2, 3, 4, 5,
Friday, November 28, 2008
Point out the error if any
main() {
int i=1;
while()
{ printf("%d",i++);
if(i>10) break; }
}
a. The condtion in the while loop is must
b. There should be atleast a semicolon in the while()
c. The while loop should be replaced by the for loop
d. No Error
int i=1;
while()
{ printf("%d",i++);
if(i>10) break; }
}
a. The condtion in the while loop is must
b. There should be atleast a semicolon in the while()
c. The while loop should be replaced by the for loop
d. No Error
Tuesday, November 18, 2008
What is the output of following programme ?
main() {
int i, x=10, y=100%90;
for(i=1;i<=10;i++) if(x!=y) printf("x=%d y=%d", x,y); } a. The printf() function is called 10 times b. The program will produce the output x=10 y=10 c. The program will not produce any output d. The printf() function is called infinite times
int i, x=10, y=100%90;
for(i=1;i<=10;i++) if(x!=y) printf("x=%d y=%d", x,y); } a. The printf() function is called 10 times b. The program will produce the output x=10 y=10 c. The program will not produce any output d. The printf() function is called infinite times
Tuesday, November 11, 2008
You want to declare a pointer to an array of 20 elements containing double values.
Which one of the following statements do you use to declare a pointer to an array of 20 elements containing double values?
Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];
Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];
Subscribe to:
Posts (Atom)