1.) What does the following snippet print? int temperature = 78; if (temperature
ID: 3650818 • Letter: 1
Question
1.) What does the following snippet print?int temperature = 78;
if (temperature < 60) {
printf("The temperature is cold");
}
if (temperature > 90) {
printf("The temperature is hot");
}
a) (Nothing because of the compiler error.)
b) The temperature is cold.
c) The temperature is hot.
d) Nothing
2.) What does the following statement print?
printf("%d%d%d%d ", 100 > 105, 100 == 105, 103 > -105, 65.01 < 37.99);
a) 0010
b) 100 > 105, 100 == 105, 103 > -105, 65.01 < 37.99
c) 1101
d) 1010
e) 0011
3.) What does the following snippet print?
char c = '7';
printf("%d%d%d ", c == 55, c == '7', c);
// Note that the ascii value of character '7' is 55
a) 1155
b) 0055
c) 117
d) 11c
e) c == 55, c == '7', c
4.) What does the following snippet print?
if(!(100 % 10) && (30/5) > 5)
{
printf("a");
}
if((20 % 4) || (30/6) != 0)
{
printf("b");
}
a) a
b) ab
c) b
d) nothing
5.)What does the following snippet print?
if(!(100 % 10) && (30/5) > 5)
{
printf("b");
}
else if((20 % 4) || (30/6) != 0)
{
printf("a");
}
a) ab
b) b
c) ba
d) a
6.) What does the following snippet print?
int x=10;
int y=20;
char op = '%';
switch(op)
{
case '+':
printf("%d", x+y);
break;
case '%':
printf("%d", x%y);
break;
default:
printf("Invalid operator");
}
a) x%y
b) 10
c) 20
d) 0
7.) What is the Output of This Program?
#include<stdio.h>
#include<stdlib.h>
int increment(int); // prototype of increment
int main(void)
{
int c = increment(1); // calling of increment
increment(++c); // calling of increment
c = increment(++c); // calling of increment
printf("c : %d", c);
return EXIT_SUCCESS;
}
// definition of increment
int increment(int c)
{
static int count; // automatically initializes to 0
c = count++;
return ++c;
}
a) c : 5
b) none
c) c : 3
d) c : 2
e) c : 4
8.) What does the following snippet print? (Pay close attention to details.)
double x = 1.9;
double y = 2.0;
double result = (('x' > 'y') ) ? y : x;
printf("%lf", result);
a) 1
b) 1.9
c) 'x'
d) 2.0
Explanation / Answer
daabbbcb
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.