Document ID: SPPU-FE-2024-FPL-PYQ-01 • Complete 11-Page Vector Edition with Official Syllabus Diagrams
Official SPPU Recommended Syllabus Literature (NEP-2020 ESC-105-COM): This master question bank strictly adheres to the canonical definitions, algorithms, and methods of the prescribed university textbooks:
1) Programming in ANSI C by E. Balagurusamy (Tata McGraw-Hill),
2) Fundamentals of Programming Languages by Nirali Prakashan (Dr. Nitin N. Sakhare, Dr. Hemantkumar B. Jadhav, SPPU 2024 Course), and
3) Schaum's Outline: Programming with C by Byron S. Gottfried (McGraw-Hill).
Examiner Weightage Note: Continuous Comprehensive Evaluation (CCE/In-Sem) comprises 30 Marks (Units I, II, III). End-Semester Examination (ESE) comprises 70 Marks (Units I through VI). Full 8-mark questions demand theoretical concept, formal syntax, complete ANSI C99 code, step-by-step dry-run tracing tables, and sample terminal I/O.
Unit I: Program Planning & C Programming Fundamentals
In-Sem: 10M | End-Sem: 12M
1. Core Algorithmic Principles & ISO Geometric Symbols
An algorithm is an ordered, deterministic, finite sequence of computational steps transforming formal input into unambiguous output. It must satisfy five fundamental criteria: Input (≥ 0), Output (≥ 1), Finiteness, Definiteness, and Feasibility.
| Symbol Name | Geometric Contour | Operational Function | C Counterpart |
| Terminal | Oval / Rounded Rectangle | Marks entry or exit boundary of routine | int main() / return 0; |
| Input / Output | Parallelogram | Reads data or writes computed results | scanf() / printf() |
| Process | Rectangle | Arithmetic calculation, variable initialization | D = b*b - 4*a*c; |
| Decision | Diamond (Rhombus) | Evaluates Boolean condition for True/False branches | if (D >= 0) |
| Connector | Circle | Joins converging control flows on same page | Labels / goto anchors |
2. Step-by-Step Quadratic Equation Algorithm
- Step 1: Start.
- Step 2: Read floating-point coefficients
a, b, c.
- Step 3: If
a == 0, print "Degenerate equation: Linear (x = -c/b)" and terminate.
- Step 4: Compute discriminant:
D = (b * b) - (4 * a * c).
- Step 5: If D > 0: Roots are real and distinct. Compute
r1 = (-b + sqrt(D)) / (2*a) and r2 = (-b - sqrt(D)) / (2*a).
- Step 6: Else If D == 0: Roots are real and equal. Compute
r1 = r2 = -b / (2*a).
- Step 7: Else (D < 0): Roots are complex conjugates. Compute
real = -b / (2*a) and imag = sqrt(-D) / (2*a). Display real ± i*imag.
- Step 8: Stop.
| Storage Class | Keyword | Memory Segment | Default Value | Scope | Lifetime |
| Automatic | auto | Stack Frame | Garbage | Local block | Till block exit |
| Register | register | CPU Register / Stack | Garbage | Local block | Till block exit |
| Static | static | Data Segment (BSS) | Zero (0) | Local to block/file | Entire program run |
| External | extern | Data Segment | Zero (0) | Global across files | Entire program run |
#include <stdio.h>
void executeScopeDemo() {
auto int autoCounter = 1; /* Re-created on stack upon each invocation */
static int staticCounter = 1; /* Initialized ONCE in data segment; value persists */
printf("autoCounter = %d | staticCounter = %d\n", autoCounter, staticCounter);
autoCounter++;
staticCounter++;
}
int main() {
printf("Call 1: "); executeScopeDemo(); /* autoCounter = 1 | staticCounter = 1 */
printf("Call 2: "); executeScopeDemo(); /* autoCounter = 1 | staticCounter = 2 */
printf("Call 3: "); executeScopeDemo(); /* autoCounter = 1 | staticCounter = 3 */
return 0;
}
Unit II: Operators and Expressions
In-Sem: 10M | End-Sem: 10M
Operand binary representations in 8-bit notation: a = 12 = 00001100_2, b = 25 = 00011001_2.
- Bitwise AND (a & b):
00001100 & 00011001 = 00001000_2 = 8_10
- Bitwise OR (a | b):
00001100 | 00011001 = 00011101_2 = 29_10
- Bitwise XOR (a ^ b):
00001100 ^ 00011001 = 00010101_2 = 21_10
- Left Shift (a << 2):
00001100 << 2 = 00110000_2 = 48_10 (Formula: 12 * 2^2 = 48)
- Right Shift (b >> 2):
00011001 >> 2 = 00000110_2 = 6_10 (Formula: floor(25 / 2^2) = 6)
Unit III: Control Structures (Branching & Iteration)
In-Sem: 10M | End-Sem: 12M
#include <stdio.h>
int main() {
int num, originalNum, remainder, accumulatedSum = 0;
printf("Enter a 3-digit positive integer: ");
if (scanf("%d", &num) != 1 || num < 0) return 1;
originalNum = num;
while (originalNum != 0) {
remainder = originalNum % 10; /* Extract terminal digit */
accumulatedSum += (remainder * remainder * remainder); /* Cube and accumulate */
originalNum /= 10; /* Truncate terminal digit */
}
if (accumulatedSum == num)
printf("%d is an Armstrong Number.\n", num);
else
printf("%d is NOT an Armstrong Number.\n", num);
return 0;
}
| Iteration | originalNum (Start) | remainder (% 10) | Cube Computed | accumulatedSum | originalNum (End) |
| Iteration 1 | 153 | 3 | 3³ = 27 | 0 + 27 = 27 | 15 |
| Iteration 2 | 15 | 5 | 5³ = 125 | 27 + 125 = 152 | 1 |
| Iteration 3 | 1 | 1 | 1³ = 1 | 152 + 1 = 153 | 0 (Terminates) |
Unit IV: Arrays and String Manipulation
End-Sem Weightage: 14M
#include <stdio.h>
#define MAX 10
int main() {
int a[MAX][MAX], b[MAX][MAX], result[MAX][MAX];
int r1, c1, r2, c2, i, j, k;
printf("Enter Matrix A rows and columns: "); scanf("%d %d", &r1, &c1);
printf("Enter Matrix B rows and columns: "); scanf("%d %d", &r2, &c2);
/* Dimensional Compatibility Check */
if (c1 != r2) {
printf("Error: Matrix multiplication undefined (cols of A != rows of B).\n");
return 1;
}
/* Input Matrix A and B omitted for brevity */
for (i = 0; i < r1; i++) {
for (j = 0; j < c2; j++) {
result[i][j] = 0; /* Reset dot product accumulator */
for (k = 0; k < c1; k++) {
result[i][j] += a[i][k] * b[k][j];
}
}
}
return 0;
}
Unit V: Modular Programming & User-Defined Functions
End-Sem Weightage: 14M
| Evaluation Parameter | Call by Value | Call by Reference (Pointers) |
| Mechanism of Passage | Value copies of actual parameters passed | Memory addresses (&a, &b) passed |
| Caller Variable Modification | Changes in callee do NOT affect caller | Changes in callee directly modify caller memory |
| Stack Allocation | Allocates duplicate variables on stack | Operates via pointer indirection (*ptr) |
| Memory Overhead | Proportional to data structure size | Fixed 4 or 8 bytes per address pointer |
#include <stdio.h>
/* FAILS: Call by Value (Modifies local stack copies only) */
void swapByValue(int x, int y) {
int temp = x; x = y; y = temp;
}
/* SUCCEEDS: Call by Reference (Dereferences caller memory addresses) */
void swapByReference(int *x, int *y) {
int temp = *x; *x = *y; *y = temp;
}
int main() {
int a = 10, b = 20;
swapByValue(a, b);
printf("After Value: a = %d, b = %d (UNALTERED)\n", a, b);
swapByReference(&a, &b);
printf("After Reference: a = %d, b = %d (SWAPPED)\n", a, b);
return 0;
}
Unit VI: Structures, Unions & File Operations
End-Sem Weightage: 16M
| Evaluation Criterion | Structure (struct) | Union (union) |
| Keyword | struct | union |
| Memory Allocation | Sum of sizes of all individual members (+ padding) | Size of the LARGEST member only |
| Starting Offset | Each member has a distinct memory address | All members share the exact same starting address |
| Concurrency | All members retain valid data simultaneously | Only ONE member can hold valid data at any instant |
| Data Overwrite Risk | Writing to one member has no effect on others | Writing to one member overwrites other members |
#include <stdio.h>
struct Student {
int rollNo;
char name[32];
float marks[3];
float percentage;
};
int main() {
struct Student students[5]; int topperIndex = 0;
for (int i = 0; i < 5; i++) {
printf("\nEnter Record for Student %d:\n", i + 1);
scanf("%d %s", &students[i].rollNo, students[i].name);
float total = 0;
for (int j = 0; j < 3; j++) {
scanf("%f", &students[i].marks[j]);
total += students[i].marks[j];
}
students[i].percentage = total / 3.0f;
if (students[i].percentage > students[topperIndex].percentage) topperIndex = i;
}
printf("\nTOPPER: Roll: %d, Name: %s, Percentage: %.2f%%\n",
students[topperIndex].rollNo, students[topperIndex].name, students[topperIndex].percentage);
return 0;
}