1) For the function xb Vba-ac , what are the conditions needed sox is a real num
ID: 3741709 • Letter: 1
Question
1) For the function xb Vba-ac , what are the conditions needed sox is a real number ? (Note: 1) 2a not a C code) A) a 0, b2-4ac20 D) a 0,b2-4ac>0 2) What is the output of the following code ? 2) float count 12.345678; printf"%5.3I" count) A) 12.346 B) 12.35 C) 12.345 D) 12.34 E) 12.4 3) The right C statement for the following formula is (PI is defined previously) 3) A) VSph = (4/3).PI.(r.r.r); B) VSph-4.0/3*Pi.(r*t*r); C) VSph 43 PI(Gr) D) all of the above E) A and B are correct 4) 4) int a-2,b-2,c; c-a*b: printf ("input a : ") ; scanf("%d",&a;); printf ("input b : ")iscanf ("d", &b;): printf ("a x b d" c) If the user inputs a 7 and b- 3, the output c of the above program is B) 4 C) 3 D) 18 A) 21 5) 5) What is the value of count after the following code ? int count 0: double x3, y-l: count++i if(yco) count-- else count+ti A) 1 B) 2 D) 3Explanation / Answer
2) What is the output of the following code ?
float count = 12.345678;
printf("%5.3lf",count);
Answer: Option A)12.346
Explanation:
Program:
#include<stdio.h>
int main()
{
float count = 12.345678;
printf("%5.3lf",count);
}
Output: 12.346
3) The right C statement for the following formula is (P1 is defined previously)
Vsph = 4/3 PIr^3
Answer: Option: D) all of the above
Explanation:
A) Program:
#include<stdio.h>
#define PI 3.14
int main() {
int r=10;
float VSph = (4/3)*PI*(r*r*r);
printf("%f",VSph);
}
Output: 3140.000000
B) Program:
#include<stdio.h>
#define PI 3.14
int main() {
int r=10;
float VSph = 4.0/3*PI*(r*r*r);
printf("%f",VSph);
}
Output: 4186.666504
C) Program:
#include<stdio.h>
#define PI 3.14
int main() {
int r=10;
float VSph = 4/3*PI*(r*r*r);
printf("%f",VSph);
}
Output: 3140.000000
4) int a=2,b=2,c;
c=a*b;
printf ("input a : ");scanf ("%d",&a);
printf ("input b ");scanf("%d",&b);
printf ("a x b =%d",c);
If the user inputs a- 7 and b - 3, the output c of the above program is
Answer: Option B) 4
Explanation:
Program:
#include<stdio.h>
int main() {
int a=2,b=2,c;
c=a*b;
printf ("input a : ");scanf ("%d",&a);
printf ("input b ");scanf("%d",&b);
printf ("a x b =%d",c);
}
Output: input a : 7
input b : 3
a x b =4
5) What is the value of count after the following code ?
int count = 0;
double x = -3, y=l;
count++;
y=-x;
if (y<0)
count--;
else
count++;
Answer: Option B) 2
Explanation:
Program:
#include<stdio.h>
int main() {
int count = 0;
double x = -3, y=1;
count++;
y=-x;
if (y<0)
count--;
else
count++;
printf("Count = %d", count);
}
Output:: Count = 2
6) What is the best form of printf to have lined-up output shown ?
2.34
9.56
11.11
34.00
99.02
100.92
Answer: Option A) printf ("%6.2lf",x);
7) In a do/while statement below
do{ statement;
}while(expression);
The following expression will have the statement executed for !(0 < k < 10)
Answer: Option :A) k < = 0 I I k>= 10
8) Given the following code
int k, t(5)=[-8, 6,9, 0, 8];
for (k=l; k<4; k++)
t(k+1) = t[k] ;
The value of t(3) is
Answer: option A) 6
Explanation:
Program:
#include<stdio.h>
int main() {
int k, t[5]={-8,6,9,0,8};
for(k=1;k<4;k++)
{
t[k+1] = t[k];
}
printf("t[3] = %d", t[3]);
}
Output: t[3] = 6
9) An array is initialized as the following :
int A[5] ={0,1,2,3,4};
Which is the right C statement to achieve the same initialization ?
Answer: Option C) for (i=1;i<=5;i++) A[i]=i;
Explanation:
Program;
#include<stdio.h>
int main() {
int A[5] ={0,1,2,3,4};
for (int i=1;i<=5;i++) A[i]=i;
printf("A[1] = %d", A[1]);
}
Output: A[1] = 1
10) TRUE/FALSE Write T if the statement is true and 'F if the statement is false.
b/a*k != k/a*b
Answer: FALSE
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.