C Programming Trivia Quiz On Format Specifiers!

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Nikhilnainta
N
Nikhilnainta
Community Contributor
Quizzes Created: 1 | Total Attempts: 258
Questions: 20 | Attempts: 259

SettingsSettingsSettings
C Programming Trivia Quiz On Format Specifiers! - Quiz

Below is a C programming trivia quiz of format specifiers. According to our classes Format specifier is used during input and output. It is a way to tell the compiler what type of data is in a variable during taking input or printing. Take up this test and get to see just how much you got to understand through the study!


Questions and Answers
  • 1. 

    What is the proper syntax for do-while?

    • A.

      Do { statement} while {condition};

    • B.

      Do { statement} while {condition}{statement}

    • C.

      Do { statement} while (condition) {statement}

    • D.

      Do { statement} while (condition) {statement};

    Correct Answer
    D. Do { statement} while (condition) {statement};
    Explanation
    The correct answer is "do { statement} while (condition) {statement};" because it follows the proper syntax for a do-while loop. In a do-while loop, the statements inside the curly braces are executed at least once, and then the condition inside the parentheses is checked. If the condition is true, the statements are executed again, and this process continues until the condition becomes false. The semicolon at the end of the loop is also necessary to indicate the end of the loop statement.

    Rate this question:

  • 2. 

    Which of these comes on secondary constants.

    • A.

      Character constant

    • B.

      Pointer

    Correct Answer
    B. Pointer
    Explanation
    Secondary constants refer to constants that are derived from primary constants. In this case, a pointer is considered a secondary constant because it is derived from a primary constant, which is the address of a variable. Pointers are used to store memory addresses, allowing for indirect access to data. Therefore, a pointer is the correct answer as it falls under the category of secondary constants.

    Rate this question:

  • 3. 

    When you declare a variable of char type what's its range? example: char i = 'a'

    • A.

      0 to 255

    • B.

      -128 to 127

    Correct Answer
    B. -128 to 127
    Explanation
    When you declare a variable of char type, its range is from -128 to 127. This is because char is a signed data type in C++, which means it can hold both positive and negative values. The range of -128 to 127 allows char to represent a total of 256 different values, including both positive and negative numbers.

    Rate this question:

  • 4. 

    C is a _________ sensitive.

    Correct Answer
    case
    Explanation
    The word "sensitive" is used to describe the type of sensitivity that C possesses. The word "case" is used to complete the sentence and indicate that C is case-sensitive. This means that C distinguishes between uppercase and lowercase letters and treats them as different characters.

    Rate this question:

  • 5. 

    Is c a middle-level language?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Yes, "c" is considered a middle-level language. Middle-level languages, like C, have features from both low-level languages (such as assembly language) and high-level languages (such as Python or Java). C provides low-level access to memory and hardware, allowing for efficient programming, while also offering higher-level features like functions and data structures. This makes C a versatile language that can be used for system-level programming, as well as application development.

    Rate this question:

  • 6. 

    What do we call *?

    • A.

      Address of

    • B.

      Value at

    Correct Answer
    B. Value at
    Explanation
    The given answer "value at" refers to the term used to describe the content or data stored at a specific memory location or address. It is commonly used in programming to access and manipulate the value stored in a particular memory address.

    Rate this question:

  • 7. 

    Why programmers find goto keyword seductive?

    • A.

      Unreliable

    • B.

      Unreadable

    • C.

      Hard to debug

    • D.

      All of those

    Correct Answer
    D. All of those
    Explanation
    Programmers find the goto keyword seductive because it allows them to have more control over the flow of their code. However, it is considered unreliable because it can lead to spaghetti code and make the program difficult to read and understand. Additionally, using goto can make debugging more challenging as it can create unexpected jumps in the code execution. Therefore, all of these reasons contribute to why programmers find the goto keyword seductive.

    Rate this question:

  • 8. 

    Which thing do we write under two brace () in case-control structure?

    • A.

      Statement

    • B.

      Expression

    • C.

      Constant value

    • D.

      Any variable

    Correct Answer
    B. Expression
    Explanation
    In a case-control structure, we write an expression within the two braces (). An expression is a combination of variables, constants, and operators that produces a value. It can be a mathematical calculation, a comparison, or any other operation that evaluates to a value. Within the case-control structure, the expression is used to determine which block of code should be executed based on the condition specified.

    Rate this question:

  • 9. 

    One function which is   __________ important to declare in C programming.?

    Correct Answer
    main
    Explanation
    The "main" function is the most important function to declare in C programming because it is the entry point of a C program. It is the starting point of execution and contains the code that will be executed when the program is run. Without the "main" function, the program will not be able to run and produce any output.

    Rate this question:

  • 10. 

    Int a = 1; printf ("%d%d",a,++a,a++); What is the output of the following program?

    • A.

      122

    • B.

      123

    • C.

      331

    • D.

      321

    Correct Answer
    C. 331
    Explanation
    The output of the program is 331. In the printf statement, the first occurrence of %d prints the value of a, which is 1. The second occurrence of %d is evaluated as ++a, which increments the value of a to 2 and returns the incremented value. So, the second occurrence of %d also prints 2. Finally, the third occurrence of %d is evaluated as a++, which returns the current value of a (2) and then increments it to 3. Therefore, the third occurrence of %d prints 3. Hence, the output is 331.

    Rate this question:

  • 11. 

    A break is usually associated with an __________?

    Correct Answer
    if
    Explanation
    A break is usually associated with an "if" statement in programming. The "if" statement is used to conditionally execute a block of code based on a certain condition. When the condition specified in the "if" statement is true, the code inside the block is executed, otherwise, it is skipped. Therefore, a break statement is commonly used within an "if" statement to terminate the execution of the block of code and exit the loop or switch statement that contains it.

    Rate this question:

  • 12. 

    Break keyword _________out of a loop instantly?

    Correct Answer
    jump
    Explanation
    The "jump" keyword is used to break out of a loop instantly. It allows the program to skip the remaining iterations of the loop and continue executing the code after the loop. This is useful when a specific condition is met and the program needs to exit the loop immediately.

    Rate this question:

  • 13. 

    When continue is encountered  inside any loop, control automatically passes to the __________of the loop?

    Correct Answer
    beginning
    Explanation
    When continue is encountered inside any loop, control automatically passes to the beginning of the loop. This means that the remaining statements within the loop are skipped and the loop starts again from the beginning, evaluating the loop condition and executing the loop body again if the condition is true. This allows the loop to continue iterating without executing the remaining statements in the current iteration.

    Rate this question:

  • 14. 

    What is the default or initial value of the static storage class?

    • A.

      One

    • B.

      Zero

    • C.

      Garbage value

    • D.

      No one of these

    Correct Answer
    B. Zero
    Explanation
    The default or initial value of the static storage class is zero.

    Rate this question:

  • 15. 

    How many types of storage classes in C are_______?

    Correct Answer
    four
    4
    Explanation
    There are four types of storage classes in C: auto, register, static, and extern. These storage classes determine the scope, lifetime, and visibility of variables in a C program. The options "four" and "4" both represent the correct answer.

    Rate this question:

  • 16. 

    How many bytes long double store in memory?

    • A.

      4

    • B.

      8

    • C.

      10

    • D.

      12

    Correct Answer
    C. 10
  • 17. 

    Which one of the format modifier for unsigned int?

    • A.

      %d

    • B.

      %u

    • C.

      %ld

    • D.

      %lf

    Correct Answer
    B. %u
    Explanation
    The correct format modifier for an unsigned int is %u. This format specifier is used to print unsigned integer values. It is important to use the correct format modifier to ensure that the value is displayed correctly and to avoid any potential errors or unexpected behavior in the program.

    Rate this question:

  • 18. 

    Both the inverted comma's should point to the left eg: 'b' is a true statement.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The given answer is true because the statement states that both the inverted commas should point to the left. Since the inverted commas in the example are indeed pointing to the left, the answer is true.

    Rate this question:

  • 19. 

    There are __________ keywords in c language?

    Correct Answer
    32
    thirty two
    Explanation
    The correct answer is 32. In the C language, there are 32 keywords. These keywords are reserved and have specific meanings in the language. They cannot be used as variable names or identifiers in the program. Some examples of C keywords include "if," "for," "while," and "int."

    Rate this question:

  • 20. 

    How many types of comments in C language ________ ?

    Correct Answer
    2
    two
    Explanation
    There are two types of comments in the C language: single-line comments and multi-line comments. Single-line comments are denoted by // and can be used to comment out a single line of code. Multi-line comments are denoted by /* and */ and can be used to comment out multiple lines of code.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 17, 2011
    Quiz Created by
    Nikhilnainta
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.