C Programming MCQ's - Set 2

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 Deepchawla
D
Deepchawla
Community Contributor
Quizzes Created: 2 | Total Attempts: 2,429
Questions: 10 | Attempts: 691

SettingsSettingsSettings
C Programming MCQs - Set 2 - Quiz

This quiz provides you the basic multiple choice questions on C constants.


Questions and Answers
  • 1. 

    Character Set of C language contains ?

    • A.

      Alphabets

    • B.

      Digits

    • C.

      Special Symbols

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    The character set of the C language includes alphabets, digits, and special symbols. This means that any combination of letters, numbers, and special characters can be used in C programming. Therefore, the correct answer is "All of these."

    Rate this question:

  • 2. 

    A variable name can have ?

    • A.

      Any special symbol

    • B.

      Blank space

    • C.

      Comma ( , )

    • D.

      Underscore

    Correct Answer
    D. Underscore
    Explanation
    A variable name can have an underscore because it is a valid character in most programming languages to separate words within a variable name. It is commonly used to improve readability and make the variable name more descriptive. Using an underscore can make the variable name more meaningful and easier to understand, especially when the variable name consists of multiple words.

    Rate this question:

  • 3. 

    In C language , one of the following is not a valid data type

    • A.

      Long

    • B.

      Float

    • C.

      Double

    • D.

      Char

    Correct Answer
    A. Long
    Explanation
    In C language, long is a valid data type. It is used to store larger integer values than the int data type. The long data type occupies more memory space compared to the int data type. Other valid data types in C language are float, double, and char. Float and double are used to store floating-point numbers, while char is used to store single characters.

    Rate this question:

  • 4. 

    The format string %lf is used for ?

    • A.

      Float

    • B.

      Double

    • C.

      Unsigned int

    • D.

      Long double

    Correct Answer
    D. Long double
    Explanation
    The format string %lf is used for long double because the 'l' in %lf stands for "long" and 'f' stands for "float". Therefore, %lf is used to format and print long double values.

    Rate this question:

  • 5. 

    A variable of type unsigned int can have a value in the range of ?

    • A.

      -32768 to +32767

    • B.

      0 to 32767

    • C.

      0 to 65535

    • D.

      -32767 to +32767

    Correct Answer
    C. 0 to 65535
    Explanation
    A variable of type unsigned int can have a value in the range of 0 to 65535. Unsigned int is a data type that only allows positive integers or zero, and it can store values up to 2^16 - 1, which is 65535. The range starts from 0 because it does not allow negative values.

    Rate this question:

  • 6. 

    Which data type is not a primary data type

    • A.

      Int

    • B.

      Array

    • C.

      Float

    • D.

      Char

    Correct Answer
    B. Array
    Explanation
    The given options are int, array, float, and char. Out of these options, array is not a primary data type. In programming, a primary data type refers to the basic data types that are built-in and provided by the programming language itself. These primary data types include int, float, and char. However, array is not a primary data type as it is a composite data type that allows storing multiple values of the same data type.

    Rate this question:

  • 7. 

    Which of the format string is not valid ?

    • A.

      %ld

    • B.

      %lf

    • C.

      %lu

    • D.

      %lc

    Correct Answer
    D. %lc
    Explanation
    The format string "%lc" is not valid because the "%lc" format specifier is used for wide characters in some programming languages, such as C, but it is not a valid format specifier in most common programming languages like C++, Java, or Python. The correct format specifier for a wide character is "%lc" or "%C".

    Rate this question:

  • 8. 

    Which is the valid string data

    • A.

      'A'

    • B.

      A

    • C.

      "A"

    • D.

      None of these

    Correct Answer
    C. "A"
    Explanation
    The valid string data in this case is "A" because it is enclosed within double quotation marks. The other options, 'A' and A, are not valid string data as they are not enclosed within quotation marks. The option "None of these" is not a valid string data either as it does not represent any specific string value.

    Rate this question:

  • 9. 

    How much memory is required to store a value of type double ?

    • A.

      4 bytes

    • B.

      6 bytes

    • C.

      8 bytes

    • D.

      10 bytes

    Correct Answer
    C. 8 bytes
    Explanation
    A value of type double requires 8 bytes of memory. The double data type is used to store decimal numbers with a higher precision compared to the float data type. It occupies 64 bits of memory, allowing it to hold a wider range of values with greater accuracy.

    Rate this question:

  • 10. 

    The modifier which is used to declare a variable as constant

    • A.

      Short

    • B.

      Signed

    • C.

      Unsigned

    • D.

      Const

    Correct Answer
    D. Const
    Explanation
    The correct answer is "const". The const modifier is used to declare a variable as constant, meaning its value cannot be changed once it has been assigned.

    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
  • Feb 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 22, 2012
    Quiz Created by
    Deepchawla
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.