Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to include the standard input-output header file.
C
#include [1] int main() { printf("Hello, world!\n"); return 0; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes instead of angle brackets for standard headers.
Including the wrong header file like stdlib.h.
✗ Incorrect
The standard input-output header file is included using angle brackets: #include .
2fill in blank
mediumComplete the code to include a user-defined header file named "myheader.h".
C
#include [1] void greet(); int main() { greet(); return 0; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using angle brackets for user-defined headers.
Including the wrong header file.
✗ Incorrect
User-defined headers are included using double quotes: #include "myheader.h".
3fill in blank
hardFix the error in the include directive to correctly include the math header.
C
#include [1] int main() { double result = sqrt(16.0); return 0; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the .h extension.
Using quotes instead of angle brackets.
✗ Incorrect
The math header is a standard library header and must be included with angle brackets: #include .
4fill in blank
hardFill both blanks to include the header and declare a function prototype.
C
#include [1] [2] greet(); int main() { greet(); return 0; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using angle brackets for user headers.
Omitting the return type in function prototype.
✗ Incorrect
User header included with quotes and function prototype declared with return type void.
5fill in blank
hardFill all three blanks to create a header guard in a header file.
C
#ifndef [1] #define [2] void greet(); #endif // [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different macro names in the guard.
Omitting the header guard entirely.
✗ Incorrect
Header guards use the same unique macro name to prevent multiple inclusions.