C Preprocessor Directives and Function Declaration Quiz
12 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 is the primary purpose of the #undef preprocessor directive in C?

  • To include a header file
  • To clear a macro definition (correct)
  • To define a macro
  • To check if a macro is defined
  • Which of the following is NOT a feature of C programming language?

  • Dynamic typing (correct)
  • Recursion support
  • Structured programming
  • Garbage collection
  • What is the purpose of the printf function in C?

  • To display output on the screen (correct)
  • To perform mathematical calculations
  • To read input from the user
  • To define a new function
  • What does a function declaration in C include?

    <p>Return type, name of function, function arguments (D)</p> Signup and view all the answers

    What is the purpose of lexical variable scope in C?

    <p>Limits the visibility of variables (B)</p> Signup and view all the answers

    Which preprocessor directive in C is used to substitute a preprocessor macro?

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

    What is the primary purpose of using the #ifdef preprocessor directive in C?

    <p>To conditionally include or exclude code during compilation (B)</p> Signup and view all the answers

    Which statement regarding C's type system is true?

    <p>It is statically typed (C)</p> Signup and view all the answers

    What role does the return statement play in a C function?

    <p>It terminates the function and returns a value to the caller (D)</p> Signup and view all the answers

    What is the primary benefit of utilizing lexical variable scope in C?

    <p>It limits the visibility of variables within a block of code (B)</p> Signup and view all the answers

    How are functions invoked in C?

    <p>By calling their names within another function (C)</p> Signup and view all the answers

    What best describes the purpose of the #define preprocessor directive in C?

    <p>To define constants or macros for reuse in the code (A)</p> Signup and view all the answers

    More Like This

    C Programming: Preprocessor Directives Quiz
    9 questions
    C Programming Chapter 1 and 2 Review
    36 questions
    C Functions and Preprocessor Directives
    5 questions
    C Programming: Functions and Directives
    5 questions
    Use Quizgecko on...
    Browser
    Browser