
C Programming Quiz
Quiz
•
Engineering
•
University
•
Hard
Ani Harish
Used 3+ times
FREE Resource
Enhance your content in a minute
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is the purpose of a function in C programming?
To store data permanently
To manage memory
To perform a specific task
To define variables
Answer explanation
In C programming, a function is designed to perform a specific task, allowing for code reusability and organization. This makes it easier to manage complex programs by breaking them into smaller, manageable pieces.
2.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
Which part of a function contains the code that executes when the function is called?
Function prototype
Function header
Function body
Function declaration
Answer explanation
The function body contains the actual code that runs when the function is called. It includes the statements that define what the function does, making it the correct choice.
3.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is recursion in programming?
A method to repeat a block of code
A function calling itself
A technique to manage memory
A way to define variables
Answer explanation
Recursion in programming refers to a function that calls itself to solve a problem. This allows for tasks to be broken down into smaller, more manageable subproblems, making it a powerful technique for certain algorithms.
4.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is the correct syntax for a function declaration in C?
function_name(data_type arg1, data_type arg2);
function_name(data_type arg1, data_type arg2) data_type;
data_type function_name(data_type arg1, data_type arg2);
data_type function_name(arg1, arg2);
Answer explanation
The correct syntax for a function declaration in C is 'data_type function_name(data_type arg1, data_type arg2);'. This format specifies the return type, function name, and parameters with their types.
5.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
Which storage class preserves the value of a variable across function calls?
Automatic
Register
Static
External
Answer explanation
The 'static' storage class preserves the value of a variable between function calls, allowing it to retain its state. In contrast, 'automatic' and 'register' variables do not maintain their values after the function exits.
6.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is the purpose of the 'extern' keyword in C?
To declare a local variable
To define a function prototype
To declare a global variable accessible across files
To allocate memory
Answer explanation
The 'extern' keyword in C is used to declare a global variable that can be accessed across multiple files. This allows for better modularity and code organization, making it the correct choice.
7.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
How do you pass an array to a function in C?
By passing each element individually
By passing the array size
By passing the array name without brackets
By passing a pointer to the array
Answer explanation
In C, you pass an array to a function by using the array name without brackets. This effectively passes a pointer to the first element of the array, allowing the function to access the entire array.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
11 questions
Equilibrium & Truss
Quiz
•
University
10 questions
Unit 2: Microcontrollers
Quiz
•
University
15 questions
Digital Electronics Quiz -U1-U2
Quiz
•
University
15 questions
RoboRover
Quiz
•
University
15 questions
TECH WHIZ
Quiz
•
University
15 questions
ELECTRO 1 SW 1 BROMINE
Quiz
•
University
14 questions
NLP Quizz Unit-3
Quiz
•
University
15 questions
GCSE Design and Technology: Production Techniques Quiz
Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
4 questions
Activity set 10/24
Lesson
•
6th - 8th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
30 questions
October: Math Fluency: Multiply and Divide
Quiz
•
7th Grade
Discover more resources for Engineering
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
7 questions
Central Idea of Informational Text
Interactive video
•
4th Grade - University
7 questions
Review for You: Using Commas
Interactive video
•
4th Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
Safari Scholar: Searching for Subject-Verb Agreement
Interactive video
•
4th Grade - University
