#include<stdio.h>
int main()
{
double x[4] = {3.13,1.62,2.72,654.1};
printf("%d\t%c\t%f",(int)(100**(x+1)),(int)x[3]/10,x[2]);
}
OUTPUT
162 A
2.720000
Explanation
(int)(100**(x+1)), will return 162. Because *(x+1) = 1.62. Then 100 * *(x+1) means 162. So it will print 162 because it will print the integer part only.
(int)x[3]/10 wll return A. bcause x[3] = 654.1/ x[3]/10 = 65.41. (int)x[3]/10 will return 65 only. Since we will print it in charcater form so ascii value of 65 is A.
x[2] will print 2.720000. because the float values prints 6 decimal places by default
in C.
Question 5 10 pts Predict the output of the following C program: #include <stdio.h> void mainot...
Question 8 Predict the output of the following C program: 5 #include <stdio.h> void binaryCode(int n) printf("1"); if(n=2) return; binaryCode(n-1); int i = 0; for(; i<n;i++) printf("O"); binaryCode(n-2); } void main() { binaryCode(3); 12pt v Paragraph Β Ι Ο Avor T²v ...
Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int i = 0; for(; 1; i++){ printf("%d",i); if(i==7) break; } 12pt Paragraph 1 Β Ι Ο Αν και Ta
Question 2 Predict the output of the following program: #include <stdio.h> void mainot printf("%d %d %d" 10 > -1, (unsigned) 10 > -1, (unsigned) (10 > 1));
Question 6 Predict the output of the following question: 8 pts #include <stdio.h> #include<string.h> char al(5)={ "gate", "kate","rate","date" ); void rec(char a[][5], int n){ if(n<= 1) return; char temp[5]; strcpy(temp'a);//copies the string stored in a into temp strcpy(*a,a[n-1]); strcpy(a[n-1),temp); rec(a+1,n-2); } void main() { rec(a 4); int i = 0; for(;i<4;i++) a[i][4]+= 10; printf("%s", a); }
QUESTION 12 What is the output of the following program? #include <stdio.h> int main(void) printf("From sealnto shininginC"); O a. From sea to shining O b. From sea to shining O c. From seanto shining nC O d. From sea to shining C
Question 4 20 pts Predict the output of the following C program (use to explicitly show space characters in your answer): #include <stdio.h> void mainot printf("%+-9.2f!!% 4.1f!!%3.f!!%f!!%12.6s", 2.67, 1243.26. (double)9/5.(double)(915). "Goodbye!!!"); 12pt Paragraph в I o А еті: p O words
OPERATING SYSTWM
Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...
7 Question 27 4 pts What is displayed by this program? #include <stdio.h> void seven(int *xPtr); int main(void) int x,y: X-5: y = 6: seven(&x): seven(&y): printf("%4d%4d\n", x,y); return(0); void seven(int "xPtr) inty: y -'xPtr+2; *xPtry3; (Show blank spaces with asterisks)
1. What is the output of the following program? include <stdio.h> int wilma (int x) if (x<5) x = 7; return (x) int main (void) int x-1 x=wilma (x) ; printf ("%d", x); return (0) b)3 c) 4 d) 7 a) 1 e) none of these
computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int 10 for(= 0; i < 101) printf("d", 1); A. 10 times B. 1 time C. It will run forever D. 0 times 2. What will be the output of this program? #include <stdlib.h> #include <stdio.h> int main() int a = 100, b = 200, C = 300; if(!a >= 500) b = 300; C = 400; printf("%d, 8d, &d", a, b, c); return 0;...