Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SECTION V: We have a C program with the following declarations: int a = 1 0 , b = 5 , c = 1 ,

SECTION V:
We have a C program with the following declarations:
int a=10, b=5, c=1, d=2;
double w=3.5, x=-5.0, y=2.5, z=1.0;
What will be the exact output on the screen of the
following statements? A space is indicated with the
character #. For example for the statement printf
("%5d",a);, the answer will be ###10. If a result or
expression is invalid, select "none of these".
14. printf ("%3.2lf",-a+x);
a) ###-5 b)-5.00 c)-5.0 d)-5.
e) none of these
15. printf ("%5.2lf", y/z);
a) ##2.5 b)2.50000 c) #2.50 d)2.5
e) none of these
16. printf ("%-4d",5-c/d);
a)2### b)4.5 c)4 d)5###
e) none of these
4
17. printf ("%4.2lf/", z+a*2+z-c);
a)21.00/ b)22.00/ c)21.0/ d)22.0/
e) none of these
18. printf ("3d", b+a*a);
a)150 b) #10 c)105 d)101
e) none of these
SECTION VI:
Identify the correct C statement to solve the following
problems:
19. Check for a number that is between 1 and 6 inclusively.
a) if (1 x 6) b) if (1<= x <=6)
c) if (x >=1|| x <=6) d) if (1<= x && x <=6)
e) none of these
20. Check for an even number less than 100.
a) if (x <100|| x %2) b) if (x /2 && x <100)
c) if (x %2<100) d) if (!(x %2) && x <100)
e) none of these
21. Divide a floating point (double) number by 10.
a) x = x %10; b) x = x /2*5;
c) x = x /2/5; d) x = x *10/2;
e) none of these
22. Identify the condition that will always be false.
a) if (3< x <2) b) if (x <3|| x >=2)
c) if (x <3 && x <2) d) if (x >3 && x <2)
e) none of these
5
23. Check for a real number that is a whole number (for
example, 14.0 is a whole number, 3.57 is not).
a) if (whole (x)) b) if (x == ceil(x))
c) if (floor(x)= x) d) if (x == x)
e) none of these
24. Ask the user for a whole number followed by a real
number (with decimal digits).
a) scanf ("%d %lf", a, b); b) scanf ("%lf %d", &a, &b);
c) printf ("%d %lf", a, b); d) scanf ("%d %lf", &a, &b);
e) none of these

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What was the influence of the strength of the treatment?

Answered: 1 week ago