void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
32767
Explanation:
Since i is static it is initialized to 0. Inside the while
loop the conditional operator evaluates to false, executing
i--. This continues till the integer value rotates to
positive value (32767). The while condition becomes false
and hence, comes out of the while loop, printing the i value.
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / prashanth
As i is static, it initially stores value 0.
as 0<=10 and in next stmt 0>2 is false so i-- is executed..
the loop continues till i=-32768 and when i=-32768 then
-32768>2 is false so i-- is executed..
As -32768-1 is equal to 32767. so i=32767 now..
while condition fails and it comes out of loop..
so the ans. is 32767.
Is This Answer Correct ? | 4 Yes | 0 No |
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
What is data _null_? ,Explain with code when u need to use it in data step programming ?
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])
main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }
main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcpy(a,b)); } a. “Hello” b. “Hello World” c. “HelloWorld” d. None of the above
4 Answers Corporate Society, HCL,
‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }
main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user