C Programming Multiple Choice Quiz
40 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Who is recognized as the developer of the C language?

  • Peter Norton
  • Ken Thompson
  • Dennis Richie (correct)
  • Bill Gates
  • In which year was the C programming language originally developed?

  • 1976
  • 1970
  • 1972 (correct)
  • 1980
  • What level of programming language is C considered to be?

  • High level
  • Middle level (correct)
  • Machine level
  • Low level
  • Which symbol is used to indicate a pre-processor statement in C?

    <h1></h1> Signup and view all the answers

    Which data type is considered a scalar data type in C?

    <p>Float</p> Signup and view all the answers

    What is the valid range of the 'int' data type in C?

    <p>-32768 to +32767</p> Signup and view all the answers

    Which escape sequence character is used as a line terminator in C?

    <p>\n</p> Signup and view all the answers

    Character constants in C should be enclosed within which type of quotes?

    <p>Single Quotes</p> Signup and view all the answers

    What is the maximum size of a 'double' variable?

    <p>8 bytes</p> Signup and view all the answers

    How much memory does the declaration of 'float a; double b;' occupy?

    <p>10 bytes</p> Signup and view all the answers

    Which of the following expressions correctly demonstrates a compounded assignment statement?

    <p>a += 10</p> Signup and view all the answers

    What operation does the '&&' operator perform?

    <p>Logical comparison</p> Signup and view all the answers

    Which operator is used for bitwise AND?

    <p>&amp;</p> Signup and view all the answers

    What symbol represents the equality operator?

    <p>==</p> Signup and view all the answers

    What does operator precedence determine?

    <p>Which operator is evaluated first</p> Signup and view all the answers

    What does integer division result in?

    <p>Truncating the fractional part</p> Signup and view all the answers

    What does 'a += 4' mean?

    <p>a = a + 4</p> Signup and view all the answers

    Which statement about C Library functions is correct?

    <p>C Library functions provide I/O facilities</p> Signup and view all the answers

    Which pair of functions is used for single character I/O?

    <p>getchar() and putchar()</p> Signup and view all the answers

    What value does printf() return when an error occurs?

    <p>Negative value</p> Signup and view all the answers

    What does an ampersand in scanf() before a variable name denote?

    <p>Address</p> Signup and view all the answers

    Which option correctly defines symbolic constants?

    <p>#define</p> Signup and view all the answers

    Which header file is essential for using the strcmp() function?

    <p>string.h</p> Signup and view all the answers

    Which option represents the null character?

    <p>\0</p> Signup and view all the answers

    How many keywords are available in C?

    <p>34</p> Signup and view all the answers

    What represents a character in the C language?

    <p>a character</p> Signup and view all the answers

    What is the maximum number of elements in the declaration 'int arr;'?

    <p>32</p> Signup and view all the answers

    Which of the following statements will not terminate with a semicolon?

    <p>if (x &gt; 0)</p> Signup and view all the answers

    Which of the following is an unconditional control structure?

    <p>goto</p> Signup and view all the answers

    What will be the output of the printf(“%.2f ”,17.23478)?

    <p>17.235</p> Signup and view all the answers

    Which of the following options represents the correct way to declare a pointer?

    <p>int *ptr;</p> Signup and view all the answers

    The number of arithmetic operators in C language is:

    <p>4</p> Signup and view all the answers

    What will be the value of 'x' after executing the statement 'x=y+z' where 'y=10' and 'z' is a character with value 'a'?

    <p>107</p> Signup and view all the answers

    What will be the output of the given C program that includes multiple assignment operations?

    <p>91</p> Signup and view all the answers

    What will the output be for the provided switch-case structure when 'a=7' and 'b=5'?

    <p>7</p> Signup and view all the answers

    Which of the following correctly describes the types of operators mentioned?

    <p>Binary, Unary</p> Signup and view all the answers

    What does 'INT' refer to in terms of value storage and size?

    <p>int, 16</p> Signup and view all the answers

    Which statement correctly completes the sentence about variable names?

    <p>Variable consists of letters, numbers and underscores. You can’t use keywords.</p> Signup and view all the answers

    What will be the value of 'str1' after executing the C program using string concatenation and reversal?

    <p>India is my Country!!</p> Signup and view all the answers

    What does a while statement expect since the condition is not fully shown?

    <p>A logical value.</p> Signup and view all the answers

    Study Notes

    C Programming Multiple Choice Questions

    • The developer of the C programming language is Dennis Ritchie.
    • C was developed in 1972.
    • C is a middle-level programming language.
    • C is available for all operating systems including DOS, Unix, and Windows.
    • The # symbol is used for pre-processor statements in C.
    • Float is a scalar data type in C.
    • Tokens in C include keywords, variables, and constants.
    • The valid range of the int data type is -32768 to +32767.
    • The ; symbol is used to terminate a statement in C.
    • The \n escape sequence character is a line terminator in C.
    • The \a escape sequence character is used to beep from the speaker in C.
    • Character constants are enclosed between single quotes.
    • String constants are enclosed between double quotes.
    • ‘abc’ is an invalid character constant in C, as it contains multiple characters.
    • The maximum length of a variable in C is 32 characters.
    • The maximum size of a float variable is 4 bytes.
    • The maximum size of a double variable is 8 bytes.
    • A declaration of float a; double b; occupies 12 bytes of memory (4 bytes for float & 8 bytes for double).
    • The size of a string variable is not specific and depends on the length of the string.
    • a+=10 is an example of a compounded assignment statement in C.
    • The && operator is used for logical comparison in C.
    • The & operator is used for bitwise AND in C.
    • The equality operator is represented by == in C.
    • Operator precedence determines the order in which operators are evaluated first in C.
    • The bitwise AND operator is used for masking in C.
    • The % operator is used for modulo (remainder) in C.
    • The associability of the = operator is right to left in C.
    • The () operator has the highest priority in C.
    • The || operator has the lowest priority in C.
    • Integer division in C truncates the fractional part.
    • ?: is a Ternary Operator.
    • (data type) is a type casting operator.
    • Explicit type conversion is also known as casting.
    • a+=4 is equivalent to a=a+4.
    • p++ executes faster than p=p+1 because it is a single instruction.
    • C Library functions provide input/output (I/O) facilities.
    • Header files in C contain library functions.
    • getchar() and putchar() are used for single character I/O.
    • printf() returns a negative value when an error occurs.
    • putchar(“x”) is an invalid statement in C because it attempts to pass a string to the putchar() function, which is designed for single characters.
    • An ampersand (&) in scanf() before a variable name denotes the address of the variable.
    • Symbolic constants can be defined using #define.
    • The null character is represented by \0.
    • The string.h header file is essential for using the strcmp() function.
    • malloc() is available in the stdlib.h header file.
    • ctype.h contains testing and conversion character functions.
    • C supports three looping statements: for, while, and do-while.
    • A statement differs from an expression by terminating with a semicolon (;).
    • goto is an unconditional control structure.
    • auto is a keyword used for storage class.
    • a represents a character in C language.
    • There are 7 arithmetic operators: + - * / % ++ --.
    • There are 32 keywords available in C.
    • The advantage of a UNION over a STRUCTURE is memory storage.
    • The maximum number of elements in the array declaration int arr; is not specified and depends on the compiler.
    • Array subscripts in C always start at 0.
    • *int ptr; is the correct way to declare a pointer.
    • 17.23 is the output of printf(“2.3f\n”,17.23478).
    • The values will be 5, -6 for floor(5.8) and floor(-5.8), respectively.
    • 107 is the value of X.
    • The output of the program is 91.
    • The output of the program is 12.
    • A Binary operator applies to two operands while an Unary operator applies to a single operand.
    • A variable is a place where we can store data, and the size of an INT is 16 bits.
    • Variables can consist of letters, numbers, and underscores. You cannot use keywords.
    • The output of the program is: "India is my Country".
    • The output of the program is: "India is my Country!!".

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    c-mcq.pdf

    Description

    Test your knowledge on the fundamentals of C programming with this multiple-choice quiz. Covering topics from data types to syntax rules, this quiz is perfect for beginners and those looking to refresh their understanding of C. Challenge yourself and see how well you know this essential programming language!

    Use Quizgecko on...
    Browser
    Browser