C Programming Basics Quiz
10 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

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 (B)

    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 (C)</p> Signup and view all the answers

    The operator * in C is used for division.

    <p>False (B)</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 (B)</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

    Related Documents

    2.docx

    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 Like This

    Use Quizgecko on...
    Browser
    Browser