Font size
WorksheetsIntroduction to C Programming
Total questions: 31
Worksheet time: 50mins
What is a program?
A set of instructions executed by the hardware
A type of hardware component
A document explaining a software design
A set of network protocols
Programming is the process of:
Writing, testing, and maintaining computer programs
Repairing hardware components
Managing computer networks
Using a word processor
Which language translator converts the entire source code into machine code before execution?
Interpreter
Compiler
Assembler
Linker
An interpreter:
Converts high-level code to machine code all at once
Translates and executes code line by line
Combines object files
Loads programs into memory
What is the role of an editor in programming?
Debugging errors in code
Writing and modifying source code
Converting code into machine language
Allocating memory for execution
A linker:
Loads programs into memory
Combines multiple object files
Edits source code
Executes machine code
What does a loader do?
Links multiple programs
Loads machine code into memory
Compiles source code
Edits a program
Which programming paradigm treats functions as first-class citizens?
Object-Oriented Programming
Functional Programming
Modular Programming
Structural Programming
Object-oriented programming is based on:
Functions
Modules
Objects and classes
Algorithms
Modular programming focuses on:
Writing code as a single monolithic block
Dividing code into independent modules
Using only procedural constructs
Ignoring data structures
What is program design?
The process of testing software
The creation of algorithms before coding
The debugging of source code
The execution of a program
A top-down design approach:
Starts with the details and moves to the main structure
Focuses on implementing small modules first
Breaks down the system from high-level to detailed components
Uses only one function to control execution
Which of the following is a program design tool?
Flowchart
Pseudocode
Decision tree
All of the above
A high-level language:
Uses machine-level instructions
Is closer to human language
Requires an assembler
Only works with hardware-level instructions
A low-level language is:
Machine-dependent
Easy to debug
Similar to English
Platform-independent
What is a 4GL (Fourth-Generation Language)?
A type of low-level programming language
A language designed for specific applications like databases
A hardware description language
A type of object-oriented language
What is a characteristic of C?
Platform-dependent
Object-oriented
Slow execution
Does not support pointers
Which of the following is a preprocessor directive in C?
#define
print()
int main()
return 0
What is the correct syntax for including a standard header file in C?
import
include
#include
using
Identify the correct output of the following C code:
#include
int main() {
printf("Hello, World!");
return 0;
}
Hello, World!
Compilation error
Runtime error
No output
Which keyword is used to declare a variable in C?
int
var
let
define
Which operator is used for division in C?
*
/
%
//
What will be the output of the following C program?
#include<stdio.h>
int main() {
int a , b ;
a=20;
b=35;
int sum = a+b;
printf("The sum of %d and %d is ",a, b, sum);
return 0;
}
What is the purpose of the return statement in C?
Terminates the program immediately
Returns a value from a function
Skips the next statement
Converts data types
What is an example of a selection control structure in C?
for loop
if-else statement
while loop
function call
A function in C must have:
A return type
A name
Parameters
Both a and b
In C, which statement correctly declares a function prototype?
void func(int a);
int func = (int a);
prototype func(int a);
func(int a);
What will be the output of the following C program?
2.5
2
3
Compilation Error
What will be the output of the following C program?
10
20
Compilation error
Undefined behavior
What will be the output of the following C program?
Greater than 5
Less than 5
Compilation Error
No Output
What will be the output of the following C program?
One
Two
Two
Three
Default
