“Programming Fundamentals” ✔
CC-112 2023 Solved Past Paper
→ Short Questions
→ Long Questions
→ Theory + Practical
Short Questions
Question#1
What does declaration do?
Types of Declarations
1. Variable Declaration:
Introduces a variable and specifies its type.
Example: int age;
2. Function Declaration (Prototype):
● Tells the compiler about the function's name, return type, and parameters, without
defining what the function actually does.
Example: void displayMessage();
Question#2
What happen in do while loop when the control
condition false intitially?
→In a do-while loop, the loop body is always executed at least once, regardless of
the condition. This is because the condition is checked after the loop body has been
executed.
#include <iostream>
using namespace std;
int main() {
int x = 5;
do {
cout << "This runs once!" << endl;
}
while (x < 0); // Condition is initially false
return 0;
}
Question#3
What is a function defination?
→ A function definition in C++ provides the actual implementation of a function. It specifies
what the function does, including the statements that will be executed when the function is
called. The function definition includes the function's return type, name, parameter list, and body.
#include <iostream>
using namespace std;
// Function definition
int add(int a, int b) {
int sum = a + b; // Add the two parameters
return sum; // Return the result
}
int main() {
int result = add(3, 4); // Call the function
cout << "The sum is: " << result << endl;
return 0;
}
Question#4 Question#5
pp
true false 1 1 3 3 5 9 7
Long Questions