C Programming Basics Quiz
10 Questions
0 Views

C Programming Basics Quiz

Created by
@CompatibleOnyx4685

Questions and Answers

What does #include <stdio.h> in a C program indicate?

  • Preprocessor directive to include standard input/output library (correct)
  • Start of the main function
  • Definition of a variable
  • End of the main function
  • The statement int main() declares an integer variable.

    False

    What function in C is used to print output to the screen?

    printf

    In C, to read user input, you use the ______ function.

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

    Match the following C operators with their functions:

    <ul> <li>= Addition % = Modulus (remainder) == = Equality ! = Logical NOT</li> </ul> Signup and view all the answers

    What does return 0; signify in the main function?

    <p>Successful termination of the program</p> Signup and view all the answers

    The operator * in C is used for division.

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

    Which operator in C is used for checking inequality?

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

    The statement 7 / 2 will return ______ if both operands are integers.

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

    Which of the following is a valid variable name in C?

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

    Study Notes

    C Programming Fundamentals

    • #include <> is a preprocessor directive that includes standard libraries, essential for functionalities like input/output operations.

    • Comments in C are indicated using /* */, allowing developers to add notes or disable code without affecting program execution.

    • The printf function is used to print text to the screen, crucial for displaying output in C programs.

    • int main() signifies the start of the main function in a C program, which is the entry point and returns an integer value.

    • return 0; indicates successful termination of the program, signaling that it executed without errors.

    • Valid variable names in C must start with a letter or underscore; for example, number_1 is valid while 1stNumber is not.

    • The scanf function is employed to read user input, allowing programs to interact with users.

    • The addition operator in C is denoted by +, used to perform arithmetic calculations.

    • Integer division in C truncates decimal results; thus, 7 / 2 will yield 3 when both operands are integers.

    • The % operator performs modulus operations, returning the remainder of a division, important in various calculations.

    • == is the equality operator in C, used to compare two values for equality, distinct from = which is an assignment operator.

    Studying That Suits You

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

    Quiz Team

    Description

    Test your knowledge of fundamental C programming concepts with this multiple-choice quiz. Topics include preprocessor directives, comments, and common functions like printf. Perfect for beginners looking to strengthen their understanding of C.

    More Quizzes Like This

    Mastering PHP
    5 questions

    Mastering PHP

    RecommendedLoyalty avatar
    RecommendedLoyalty
    C and C++ Preprocessor Directives
    15 questions
    BCA20002: CSS Preprocessors Quiz
    40 questions
    Use Quizgecko on...
    Browser
    Browser