C Programming Fundamentals

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Alfredhook3
A
Alfredhook3
Community Contributor
Quizzes Created: 5317 | Total Attempts: 3,143,123
| Questions: 30 | Updated: Sep 20, 2026
Please wait...
Question 1 / 31
🏆 Rank #--
0 %
0/100
Score 0/100

1. Which format specifier is used for a decimal floating point value in C?

Explanation

In C programming, the format specifier `%f` is used to represent decimal floating point values. It indicates that the corresponding argument is a floating-point number, which can include both integer and fractional parts. The other options, such as `%i` and `%d`, are used for integer values, while `%s` is for strings. Therefore, `%f` is the appropriate choice for formatting and displaying decimal numbers in output functions like `printf`.

Submit
Please wait...
About This Quiz
C Programming Fundamentals - Quiz

This assessment focuses on C programming fundamentals, covering key concepts such as algorithms, data types, variable naming, and input\/output functions. It's designed to evaluate your understanding of essential programming principles and syntax in C, making it a valuable resource for learners looking to strengthen their coding skills.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Which of the following statements about keywords in C is TRUE?

Submit

3. A semantics error in C refers to ____.

Submit

4. Which of the following correctly includes the standard I/O header file in C?

Submit

5. Which of the following is an example of a floating point literal constant in C?

Submit

6. The format specifier %i in C is used for ____.

Submit

7. Which of the following best describes structured design and development in programming?

Submit

8. Which of the following is NOT a valid identifier in C?

Submit

9. In C, a variable must be ____ before it can be used.

Submit

10. Which type of error is caused by using an undefined function or missing object files during the build process?

Submit

11. A runtime error in C occurs ____.

Submit

12. Which type of error occurs when a program compiles successfully but produces incorrect results?

Explanation

A logic error occurs when a program runs without any compilation issues but produces unintended or incorrect results. This type of error stems from flaws in the algorithm or the way the code is structured, leading to outputs that do not align with the expected behavior. Unlike syntax or runtime errors, which prevent the program from executing, logic errors can be subtle and often require careful debugging to identify and correct, as the program appears to function normally while delivering inaccurate outcomes.

Submit

13. A syntax error in C occurs when ____.

Explanation

A syntax error in C occurs when the code does not adhere to the grammatical rules defined by the C programming language. This includes issues like missing semicolons, unmatched parentheses, or incorrect use of keywords. Such errors prevent the compiler from understanding the code, leading to a failure in compilation. Unlike runtime errors, which happen during program execution, syntax errors must be resolved before the program can run at all.

Submit

14. What is the correct order of printf format specifiers?

Explanation

In C programming, the order of format specifiers in the `printf` function is important for proper formatting of output. The sequence starts with optional flags, followed by the width specification, then the optional precision, size specifier, and finally the type specifier. This order allows for flexibility in formatting, enabling developers to specify how the output should be aligned, how many digits should be displayed, and the type of data being printed, ensuring clarity and correctness in output representation.

Submit

15. Which format specifier is used to print a string in C?

Explanation

In C programming, the format specifier `%s` is used to print strings. It tells the `printf` function to expect a pointer to a character array (a string) and display the characters until it encounters a null terminator (`\0`). Other specifiers like `%c`, `%d`, and `%f` are used for printing individual characters, integers, and floating-point numbers, respectively. Therefore, `%s` is the appropriate choice for outputting a string.

Submit

16. What is an algorithm?

Explanation

An algorithm is fundamentally a systematic approach used to solve a specific problem or perform a task. It consists of a sequence of well-defined steps or instructions that lead to a desired outcome. Unlike programming languages, which are tools for implementing algorithms, an algorithm itself is an abstract concept focused on the logic and structure of problem-solving. By breaking down complex tasks into manageable steps, algorithms provide clarity and efficiency in problem resolution, making them essential in computer science and various fields.

Submit

17. Which format specifier is used for a signed decimal integer in C?

Explanation

In C programming, the format specifier `%d` is used to represent signed decimal integers. It instructs the `printf` function to interpret the corresponding argument as an integer and display it in base 10. This allows for both positive and negative integer values to be printed correctly. Other specifiers like `%c`, `%f`, and `%s` serve different purposes, such as characters, floating-point numbers, and strings, respectively, making `%d` the appropriate choice for signed integers.

Submit

18. Which format specifier is used to read or print a character in C?

Explanation

In C programming, the format specifier `%c` is used to read or print a single character. This specifier tells the input/output functions to handle a character type, allowing for proper formatting when displaying or retrieving character data. Other specifiers, such as `%d`, `%s`, and `%f`, are used for integers, strings, and floating-point numbers, respectively, making `%c` the appropriate choice for character operations.

Submit

19. Which header file must be included to use scanf() and printf() in C?

Explanation

To use the functions `scanf()` and `printf()` in C, the `stdio.h` header file must be included. This file provides the necessary declarations for standard input and output functions, allowing the program to perform operations like reading from the keyboard and writing to the console. Without including `stdio.h`, the compiler would not recognize these functions, leading to errors during compilation. Thus, including this header is essential for any program that requires formatted input and output handling.

Submit

20. Which of the following correctly defines a symbolic constant using the const keyword in C?

Explanation

In C, the `const` keyword is used to define a variable whose value cannot be changed after its initialization. The correct syntax for defining a symbolic constant is `const int COUNT = 10;`, which specifies that `COUNT` is a constant integer with a value of 10. This ensures that any attempt to modify `COUNT` later in the code will result in a compilation error, reinforcing the immutability of the constant. The other options provided either misuse the `const` keyword or do not follow proper syntax.

Submit

21. Which directive is used to define a symbolic constant in C using #define?

Explanation

In C programming, the `#define` directive is used to create symbolic constants, which are essentially placeholders for fixed values throughout the code. By using `#define SIZE 10`, any occurrence of `SIZE` in the code will be replaced with `10` during preprocessing, allowing for easier maintenance and readability. This approach helps avoid "magic numbers" in the code, making it clearer what the value represents and simplifying updates if the value needs to change later. Other options listed do not correctly define a constant in C.

Submit

22. Which prefix is used to represent a hexadecimal literal constant in C?

Explanation

In C programming, hexadecimal literals are represented using the prefix "0x". This notation indicates that the number following it is in base 16, which includes digits 0-9 and letters A-F. For example, "0x1A" represents the decimal value 26. The use of "0x" helps differentiate hexadecimal values from decimal or other numeral systems, ensuring clarity in code.

Submit

23. What is the decimal value represented by the octal literal 017 in C?

Explanation

In C, an octal literal is indicated by a leading zero. The octal number 017 translates to decimal by calculating \(1 \times 8^1 + 7 \times 8^0\). This results in \(8 + 7 = 15\). Thus, the decimal value represented by the octal literal 017 is 15.

Submit

24. Which of the following is an example of a character literal constant in C?

Explanation

In C programming, a character literal constant represents a single character enclosed in single quotes. The example 'A' is a character literal constant that specifically denotes the character 'A'. In contrast, the other options are not character literals: 15 and 0xF are numerical constants, while 017 is an octal constant. Thus, 'A' is the only option that correctly fits the definition of a character literal constant in C.

Submit

25. Which of the following is a valid rule for naming variables in C?

Explanation

In C programming, variable names are case-sensitive, meaning that identifiers like "Variable" and "variable" would be considered distinct. This feature allows programmers to create variables that differ only by case, enhancing naming flexibility. In contrast, variable names cannot start with a digit, contain spaces, or be reserved keywords, which are specific terms in the language that have predefined meanings. Understanding case sensitivity is crucial for avoiding naming conflicts and ensuring code clarity.

Submit

26. Which of the following are data type qualifiers in C?

Explanation

In C programming, data type qualifiers modify the properties of basic data types, allowing for greater flexibility in defining variables. "Short" and "long" adjust the size of integer types, while "signed" and "unsigned" determine whether the variable can hold negative values. These qualifiers enable programmers to optimize memory usage and control the range of values a variable can represent, making them essential for precise data management in C. Other options listed do not serve as qualifiers but rather represent base data types themselves.

Submit

27. Which of the following are floating point data types in C?

Explanation

In C programming, floating point data types are specifically designed to represent real numbers that require decimal points. The two primary floating point types are `float`, which typically provides single precision, and `double`, which offers double precision for greater accuracy. In contrast, `int`, `char`, `short`, and `long` are integer data types that do not support fractional values, while `signed` and `unsigned` refer to the range of integer types rather than being floating point types. Thus, `float` and `double` are the correct answer as they are explicitly used for floating point arithmetic.

Submit

28. Which of the following are integral data types in C?

Explanation

In C programming, integral data types are those that represent whole numbers without any fractional components. The 'char' type is used to store single characters, while 'int' is used for integer values. Both are fundamental types in C that fall under the category of integral data types. In contrast, 'float' and 'double' represent floating-point numbers, which include fractions, and 'void' is not a data type for storing values but rather indicates the absence of a value. Therefore, 'char' and 'int' are the correct integral data types.

Submit

29. Which data type in C is used to represent the absence of a value?

Explanation

In C programming, the `void` data type is used to indicate that a function does not return a value or that a pointer does not point to any specific data type. It represents the absence of a value or type, making it useful for functions that perform actions without producing a result. Unlike other data types like `int`, `char`, or `double`, which hold specific values, `void` signifies that there is no value to be represented, thus serving as a clear indicator of "no value" in certain contexts.

Submit

30. Which of the following are valid representations of an algorithm?

Explanation

All listed options—pseudocode, flowcharts, and programs—are valid representations of an algorithm. Pseudocode provides a high-level, human-readable outline of the steps involved, making it easy to understand. Flowcharts visually depict the flow of the algorithm using symbols and arrows, illustrating the process clearly. Programs are formal implementations of algorithms in a programming language, executing specific tasks. Each representation serves different purposes and audiences, contributing to the broader understanding and application of algorithms in problem-solving.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (30)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which format specifier is used for a decimal floating point value in...
Which of the following statements about keywords in C is TRUE?
A semantics error in C refers to ____.
Which of the following correctly includes the standard I/O header file...
Which of the following is an example of a floating point literal...
The format specifier %i in C is used for ____.
Which of the following best describes structured design and...
Which of the following is NOT a valid identifier in C?
In C, a variable must be ____ before it can be used.
Which type of error is caused by using an undefined function or...
A runtime error in C occurs ____.
Which type of error occurs when a program compiles successfully but...
A syntax error in C occurs when ____.
What is the correct order of printf format specifiers?
Which format specifier is used to print a string in C?
What is an algorithm?
Which format specifier is used for a signed decimal integer in C?
Which format specifier is used to read or print a character in C?
Which header file must be included to use scanf() and printf() in C?
Which of the following correctly defines a symbolic constant using the...
Which directive is used to define a symbolic constant in C using...
Which prefix is used to represent a hexadecimal literal constant in C?
What is the decimal value represented by the octal literal 017 in C?
Which of the following is an example of a character literal constant...
Which of the following is a valid rule for naming variables in C?
Which of the following are data type qualifiers in C?
Which of the following are floating point data types in C?
Which of the following are integral data types in C?
Which data type in C is used to represent the absence of a value?
Which of the following are valid representations of an algorithm?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!