C Tutorial menu

C Quiz

Test yourself on everything in this C tutorial. Choose an answer, then read the explanation.

Before You Start

  • Answer from memory first
  • If you miss a question, go back to that chapter
  • Type the code into a compiler to see the result for yourself

Quiz Questions

Exercise

Which header file do you need for printf and scanf?

Exercise

What does printf("%.2f", 3.14159); print?

Exercise

What is the result of 15 / 4 when both are int?

Exercise

Why does scanf("%d", &age) use the & sign?

Exercise

Which loop always runs its body at least once?

Exercise

For int a[4] = {5, 6, 7, 8}; what is a[3]?

Exercise

Which function returns the length of a string?

Exercise

What does strcmp return when two strings are equal?

Exercise

If int x = 10; int *p = &x; *p = 20; what is x now?

What Next?

Well done on finishing the C tutorial. Practise by writing a marks calculator, a simple ATM menu or a number guessing game. When you are ready, move on to the C++ tutorial, which builds on everything you learned here.

Learn C with a teacher

Join the Python Programming course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp