LearnFrenzy
Sign in Take a free test

Data Types · Exercise 2 of 4

Data Types Predict the Output

  • 12 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Read each program and choose what it prints. Every program was compiled and run on 64-bit macOS with Clang (the same answers apply to GCC on 64-bit Linux).

Question 11 Easy

What is the output of the following C program on 64-bit Linux or macOS?

main.c
#include <stdio.h>

int main(void) {
    char d = '7';
    int n = d - '0';
    printf("%d %d\n", n, d);
    return 0;
}
A 7 55
B 7 7
C 55 7
D 0 55
Question page & discussion
Question 12 Hard

What is the output of the following program, compiled as C23?

main.c
#include <stdio.h>

int main(void) {
    unsigned _BitInt(8) x = 255;
    x += 2;
    printf("%zu %zu %d\n", sizeof(true), sizeof(unsigned _BitInt(8)), (int) x);
    return 0;
}
A 4 1 257
B 1 1 1
C 4 1 1
D 1 8 257
Question page & discussion
Up next · Exercise 3Find the Error8 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links