Computer Programming B.Tech. I Year: Functions and Pointers Q&A
16 Questions
6 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 a function in C programming?

  • A function is a block of code that performs a specific task and can be executed from different parts of a program (correct)
  • A function is a data type used to store strings
  • A function is a loop used to iterate through arrays
  • A function is a variable that holds a specific value for reuse

Why do we use functions in C language?

  • To declare variables
  • To execute only once in a program
  • To store data in arrays
  • To perform repetitive tasks (correct)

What is the purpose of passing arguments to a function?

  • To specify when the function will be called
  • To store the return value of the function
  • To define the name of the function
  • To provide input to the function for processing (correct)

Which of the following is true about pointers in C?

<p>Pointers are used to point to the beginning of an array (A)</p> Signup and view all the answers

What is the purpose of dynamic memory allocation in C?

<p>To allocate memory at runtime as needed (B)</p> Signup and view all the answers

How many functions can a C program consist of?

<p>As many functions as required (B)</p> Signup and view all the answers

What is the purpose of using functions in programming?

<p>To avoid rewriting the same code over and over (D)</p> Signup and view all the answers

What is a function in programming?

<p>A subprogram that reduces coding and helps avoid repetition (C)</p> Signup and view all the answers

What is the output of the given C function 'addition' when called with parameters (10, 3)?

<p>The Result is 13 (D)</p> Signup and view all the answers

What is the main advantage of using functions in programming?

<p>It allows separate activities to be written and checked independently (A)</p> Signup and view all the answers

Which type of function in C is used for finding the square root of a number?

<p>Predefined library function (B)</p> Signup and view all the answers

What should be included to use the 'printf()' and 'scanf()' functions in C?

<p>#include (C)</p> Signup and view all the answers

Which header file should be included to use math library functions in C?

<p>#include (C)</p> Signup and view all the answers

What is the purpose of using library functions in C?

<p>To perform some operations for which functions are predefined (D)</p> Signup and view all the answers

Which function should be included to handle string manipulations in C?

<p>strlen() (C)</p> Signup and view all the answers

What is required to use input and output library functions like 'printf()' and 'scanf()' in C?

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

More Like This

Use Quizgecko on...
Browser
Browser