Master C

Section quiz

Contents

Contents

Master C

0 of 193 complete

Section quiz

Your first C program

Nine questions on what the compiler does, the errors you have now met on purpose, and what printf and scanf will and will not do for you.

Questions are shuffled within each part, and so are the answers. You can retake it as often as you like.

0 of 9 answered

Part 1: How a C program gets built

Question 1

The compiler prints a warning about your program but no error. What has it done?

Question 2

What does #include <stdio.h> actually do?

Question 3

A 400 line C program has a missing semicolon on line 380. You build it and run it. What happens?

Question 4

Your build fails with a message naming square and containing no file name and no line number. What has gone wrong?

Part 2: Getting values in and out

Question 5

int n = 5; int got = scanf("%d", &n); is given the input hello. What are got and n afterwards?

Question 6

You write scanf("%d", n); instead of scanf("%d", &n);. What is the consequence?

Question 7

You want to read a double from the input. Which is right?

Question 8

What does printf("%d", 3); printf("%d", 4); put on the screen?

Question 9

What does printf("%d\n", 7 / 2); print?

9 questions left to answer.