TU BSc CSIT C Programming (CSC115) Important Questions, Past Papers & Exam Preparation Guide
Introduction
C Programming exams at Tribhuvan University have a reliable pattern. The same question types appear year after year — not always with identical wording, but with the same underlying concepts. Prime number program, pointer swap, matrix operations, structure definition, file handling, recursion. A student who has practiced these core patterns thoroughly will recognize what each question is actually asking, even when the surface wording changes.
This guide is not a set of complete notes. If you need full chapter-wise explanations, syntax tables, and C programs with line-by-line commentary, that's all in the Complete BSc CSIT C Programming (CSC115) Guide. What this guide does is different: it maps the exam — which units appear most often, which programs are almost certain to come up, which theory comparisons are favourite short questions, and how to distribute your preparation time in the final week so you're not studying low-probability content while neglecting high-probability content.
TU's C Programming exam rewards two things above everything else: being able to write a working program from memory under time pressure, and being able to clearly explain the difference between two related concepts (call by value vs. reference, structure vs. union, malloc vs. calloc). Students who've practiced both — not just read about them — consistently score better than those who only studied theory.
This guide is useful for regular exam preparation, back exam revision, and the final-week sprint before any TU C Programming paper.
Official Course Information
| Particular | Details |
|---|---|
| Course Title | C Programming |
| Course Code | CSC115 |
| Semester | First Semester |
| Nature of Course | Theory + Lab |
| Full Marks | 60 + 20 + 20 |
| Pass Marks | 24 + 8 + 8 |
| Credit Hours | 3 |
How TU Sets the C Programming Theory Paper
The 60-mark theory paper has a consistent structure that most students don't fully map before studying:
Long questions (10 marks each): Full program writing with explanation, or detailed conceptual questions requiring definition + explanation + example. Pointers, arrays, functions, file handling, and structures dominate this section. Expect 4–5 long questions.
Short questions (5 marks each): Definitions, comparisons ("differentiate X and Y"), syntax questions, or short programs. Operators, control statements, string functions, and basic concepts appear here.
Program writing questions: You're given a task and asked to write a complete, working C program. Unlike algorithm questions, these require actual compilable code — missing #include, wrong syntax, or undefined variables all cost marks. Practice writing programs without referring to notes.
Lab/practical (20 marks): Write and run a program in the lab. Output is verified. Clean code, correct indentation, and working logic all matter. The viva (oral) component tests whether you understand what your program does.
Topic Importance Table
| Topic | Theory Weight | Practical Weight | Overall |
|---|---|---|---|
| Pointers | ★★★★★ | ★★★★★ | Must know |
| Functions + Recursion | ★★★★★ | ★★★★☆ | Must know |
| Arrays (1D + 2D) | ★★★★★ | ★★★★★ | Must know |
| File Handling | ★★★★☆ | ★★★★☆ | Very important |
| Structures + Unions | ★★★★☆ | ★★★★☆ | Very important |
| Strings | ★★★★☆ | ★★★★☆ | Very important |
| Control Statements/Loops | ★★★☆☆ | ★★★★☆ | Important |
| Operators | ★★★☆☆ | ★★★☆☆ | Medium |
| Preprocessor/Graphics | ★★☆☆☆ | ★★★☆☆ | Lower priority |
Unit-Wise Important Questions
Unit 1 & 2: Problem Solving + Elements of C
Frequently Asked Long Questions:
- Explain the structure of a C program with an example. Describe what each part does.
- What is an algorithm? Write an algorithm and flowchart to find the largest of three numbers.
- Explain the compilation process in C: preprocessing, compilation, assembly, linking.
- What are tokens in C? Explain each type with examples.
- Explain data types in C with size and range.
Frequently Asked Short Questions:
- What is the difference between a compiler and an interpreter?
- Define: token, keyword, identifier, constant, literal.
- What are escape sequences? Give five examples.
- Explain ANSI C vs C99.
- What is a header file? Why is
#include <stdio.h>needed?
Concepts You Must Understand:
- The compilation pipeline:
.c→ preprocessor → compiler → assembler → linker → executable - Difference between declaration and definition
- Variable scope: local vs global
Exam probability: ★★★☆☆ — Usually 1 short question; occasionally a long question on structure/compilation
Unit 3 & 4: Input/Output + Operators
Frequently Asked Short Questions:
- What is
scanf()? Why does it need&? - Explain operator precedence with an example.
- What is the difference between
=and==? - Explain pre-increment vs post-increment with examples.
- What is the ternary operator? Give an example.
- What is the difference between
printfandputs?
Important Comparison:
printf()vsscanf()— purpose, format specifiers, address operatorgetchar()vsgetch()vsgetche()
Exam probability: ★★★☆☆ — Short questions, occasionally tested in programs
Unit 5: Control Statements
Frequently Asked Long Questions:
- Write a C program using switch statement to display day name based on number input.
- Explain the three loop types (for, while, do-while) with examples and differences.
- Write a C program to print a multiplication table.
- Explain
breakandcontinuewith programs.
Frequently Asked Short Questions:
- Differentiate between
whileanddo-whileloops. - When is
do-whilepreferred overwhile? - What is the purpose of
exit()function?
Program patterns to practice:
- Nested loops for patterns (stars, numbers)
- Loop with break/continue
Exam probability: ★★★★☆ — Programs using loops are almost certain in the practical section
Unit 6: Arrays + Strings
Frequently Asked Long Questions:
- Write a C program for matrix addition and matrix multiplication.
- Write a C program for matrix transpose. Show the output.
- Write a C program to implement bubble sort.
- Write a C program for binary search on a sorted array.
- Explain string handling functions:
strlen(),strcpy(),strcat(),strcmp(). - Write a C program to check if a string is a palindrome without using library functions.
- Write a C program to reverse a string.
Frequently Asked Short Questions:
- How is a 2D array stored in memory?
- What is null character? Why is it important in strings?
- Differentiate between character array and string.
Exam probability: ★★★★★ — Matrix programs and string programs are almost certain every year
Unit 7: Functions
Frequently Asked Long Questions:
- Explain call by value vs call by reference with a swap program demonstrating both.
- Write a recursive C program for factorial calculation.
- Write a recursive C program for Fibonacci series.
- Explain scope, visibility, and lifetime of local and global variables.
- What is function prototype? Why is it needed?
- Write a C program demonstrating nested functions.
Frequently Asked Short Questions:
- Differentiate between library function and user-defined function.
- What is recursion? What is the base case?
- What is the difference between actual and formal parameters?
- What is a static variable? How does it differ from a local variable?
Exam probability: ★★★★★ — Functions appear in almost every long-answer section
Unit 8: Structure and Union
Frequently Asked Long Questions:
- Define structure. Write a C program using structure to store and display student records (name, roll, marks).
- Explain the difference between structure and union with an example showing memory allocation.
- Write a C program using array of structures.
- Explain nested structures with an example.
- Write a C program using pointer to structure.
Frequently Asked Short Questions:
- What is the difference between structure and union?
- How is memory allocated in a union vs a structure?
- What is
typedef? How is it used with structures?
The most tested comparison — memorize this:
| Aspect | Structure | Union |
|---|---|---|
| Memory | Each member has own memory | All members share one memory |
| Size | Sum of all members | Size of largest member |
| Active members | All simultaneously | Only one at a time |
| Use case | Group different data | Save memory when one field used at a time |
Exam probability: ★★★★☆ — Structure program with student records is a classic TU question
Unit 9: Pointers
Frequently Asked Long Questions:
- Explain pointers in C. Write a program to swap two numbers using pointers.
- Explain pointer arithmetic with examples.
- What is dynamic memory allocation? Demonstrate using
malloc()andfree(). - Explain the relationship between arrays and pointers with a program.
- Differentiate between
malloc()andcalloc().
Frequently Asked Short Questions:
- What is a NULL pointer? Why should you check for it?
- What is a dangling pointer?
- What is the difference between
*pand&p? - What is a void pointer?
The malloc vs calloc comparison — frequently tested:
| Aspect | malloc() | calloc() |
|---|---|---|
| Full form | Memory allocation | Contiguous allocation |
| Arguments | malloc(size) |
calloc(n, size) |
| Initialization | Uninitialized (garbage) | Initializes to zero |
| Use case | When you don't need zero-init | When zero-initialization needed |
Exam probability: ★★★★★ — Pointer swap and dynamic memory allocation appear almost every year
Unit 10: File Handling
Frequently Asked Long Questions:
- Write a C program to write student records to a file and read them back.
- Explain file opening modes: r, w, a, r+, w+, a+.
- Write a C program to copy contents of one file to another.
- Explain the difference between text file and binary file.
- Write a C program using
fseek()andftell()for random file access.
Frequently Asked Short Questions:
- What is the purpose of
fopen()? What does it return if it fails? - What is EOF? How is it used?
- Differentiate between
fprintf()andfscanf(). - What is
fclose()? Why must it always be called?
Exam probability: ★★★★☆ — File handling long question appears regularly; many students skip it and lose easy marks
Unit 11: Graphics
Frequently Asked Short Questions:
- What is
initgraph()? What parameters does it take? - Name five graphics functions with purpose.
- What header file is needed for graphics in C?
Exam probability: ★★☆☆☆ — Usually only 1 short question or brief notes; don't sacrifice other units for this
Most Repeated Programs (Past Paper Analysis)
These program types appear consistently across TU past papers. If you can write all of these from memory, you've covered most of the programming section.
Appeared 4+ Times
- Prime number check — loop from 2 to n/2, check divisibility
- Fibonacci series — both iterative and recursive versions
- Factorial — recursive function
- Palindrome check — for both numbers and strings
- Swap using pointers — classic call-by-reference demonstration
- Matrix addition and multiplication — 2D array programs
- Bubble sort — nested loop with swap
- Binary search — on sorted array
Appeared 2–3 Times
- Armstrong number check
- Matrix transpose
- String reverse without library functions
- String palindrome check
- Student record using structure
- File read/write with student records
- Factorial using iteration (non-recursive)
- Linear search
- Sum of array elements
- Count vowels in string
Appeared Occasionally
- Insertion sort
- Selection sort
- Count words in a string
- Copy file contents
- Dynamic array using malloc
- GCD using recursion
- Power using recursion
Most Important Theory Comparisons
These "differentiate between" pairs are favourites for short questions:
| Pair | Key Difference |
|---|---|
| Call by value vs call by reference | Value copied vs address passed; original unchanged vs can be modified |
| Structure vs union | Separate memory per member vs shared memory |
| malloc() vs calloc() | Uninitialized vs zero-initialized; 1 arg vs 2 args |
| while vs do-while | Condition checked before vs after first execution |
| Array vs pointer | Fixed size vs flexible; name is constant pointer vs reassignable |
| Local vs global variable | Scope within function vs entire program |
| Text file vs binary file | Human-readable vs binary data storage |
| Compiler vs interpreter | Translates all at once vs line-by-line |
printf vs scanf |
Output vs input; no & vs needs & for non-strings |
| Static vs dynamic memory | Fixed at compile time vs requested at runtime |
Viva Questions (Lab Exam)
Viva examiners typically ask questions about the program you just submitted and related theory:
- What does
#include <stdio.h>do? - Why do we write
return 0at the end ofmain()? - What is the difference between
=and==? What mistake do beginners make? - In your program, why does
scanfneed&? - What is a pointer? What does
*pmean vs&p? - What happens if you don't call
fclose()? - What is recursion? What would happen without a base case?
- What is the difference between
++iandi++? - Why is bubble sort O(n²)?
- What is
NULLin C? When is it used? - What does
mallocreturn if allocation fails? - What is a dangling pointer? How do you avoid it?
- Why is the
&operator not needed for string input withscanf? - What is the difference between
breakandcontinue?
One-Week Study Plan
Day 1 — Foundations + Loops
- Review structure of C program, compilation process, data types
- Write 3 loop programs from memory: multiplication table, star pattern, sum of digits
- Practice switch statement
Day 2 — Functions + Recursion
- Write factorial (recursive), Fibonacci (recursive and iterative), GCD
- Practice explaining call by value vs reference — write the swap program both ways
- Review scope and lifetime of variables
Day 3 — Arrays + Strings
- Write matrix addition, multiplication, and transpose from memory
- Write bubble sort and binary search
- Write string reverse and palindrome check without library functions
- Practice string library functions: strlen, strcpy, strcmp, strcat
Day 4 — Pointers
- Write swap using pointers
- Write array traversal using pointer arithmetic
- Write a dynamic array program using malloc/free
- Practice explaining
*p,&x, NULL pointer, dangling pointer
Day 5 — Structures + Unions
- Write student record program using structure
- Write array of structures
- Write pointer to structure
- Memorize the structure vs union comparison table
Day 6 — File Handling
- Write student record write-to-file and read-from-file program
- Write file copy program
- Memorize file opening modes (r, w, a, r+, w+, a+) with what each does
- Practice
fopen,fprintf,fscanf,fclose,feof
Day 7 — Past Questions + Revision
- Write 5 programs from memory without referring to notes
- Review all comparison tables (structure vs union, malloc vs calloc, etc.)
- Read through viva question list
- Skim graphics (Unit 11) briefly for 1 short question
Common Mistakes That Cost Marks
Syntax errors that compile as wrong logic:
- Writing
=instead of==in anifcondition — the program compiles but produces wrong output - Forgetting
&before a variable inscanf(except for strings/arrays) — reads garbage address - Missing semicolons — the classic beginner error that stops even correct logic from compiling
Pointer mistakes:
- Using an uninitialized pointer —
int *p; *p = 5;is undefined behaviour - Forgetting to check if
mallocreturned NULL before using the pointer - Not calling
free()— memory leak that doesn't affect small programs but shows understanding
File handling mistakes:
- Not checking if
fopenreturned NULL before reading/writing - Forgetting
fclose()— buffered data may not actually reach the file - Opening a file in read mode then trying to write (mode mismatch)
Array and loop mistakes:
- Accessing
arr[n]when array size is n — valid indices are 0 to n-1 - Off-by-one errors in loop conditions (
i < nvsi <= n) - Infinite loop from missing update step or wrong termination condition
Exam presentation mistakes:
- Writing pseudocode when a C program is asked — loses significant marks
- Missing
#includedirectives at the top of every program - No
return 0inmain()— technically non-standard without it - Not showing sample output when asked — examiners expect it
Practical Exam Tips
Write code that compiles, not code that's almost right. A program with a small error that you can't fix is zero marks. A slightly less elegant but fully working program scores full marks. If you're stuck on one approach, try a simpler one.
Dry-run your logic before writing. For a 10-mark program question with 20 minutes allocated, 3 minutes tracing through your algorithm on paper is time well spent. It catches logic errors before they're written as code.
Write variable names clearly. int numberOfStudents reads better to an examiner than int ns. Clean code signals understanding.
Add a brief comment at the start of each program. /* Program to check if a number is prime */ takes 5 seconds to write and demonstrates clarity. Many TU examiners appreciate it.
For theory questions: Define the concept first, then explain, then give an example. Don't start explaining without defining — you might explain something different from what the question intended.
Frequently Asked Questions
Is C Programming difficult in BSc CSIT 1st Semester?
The syntax itself isn't hard, but C has less tolerance for errors than other languages — a missing semicolon or wrong & in scanf stops the program cold. Students who practice writing programs regularly find it manageable. Those who only read theory and code struggle.
Which programs are most important for TU exams? Prime number, factorial (recursive), Fibonacci, palindrome, pointer swap, matrix addition/multiplication, bubble sort, and binary search. These eight cover a large portion of what appears in past papers. Write them from memory until they're automatic.
Are previous year questions actually repeated? The exact wording changes, but the patterns are very consistent. You won't necessarily get "Write a program to find if a number is prime" — you might get "Write a program to find all prime numbers between 1 and 100." The pattern is the same; the specific variation differs.
Which chapter carries the most marks? Pointers (Unit 9) and Functions (Unit 7) are the most consistently heavy chapters in both theory and practical. Together with Arrays (Unit 6), they account for a large portion of the paper.
Should I memorize programs? Don't memorize — understand. When you understand why the bubble sort nested loop works, you can reconstruct it for any array size. When you understand pointer arithmetic, you can write any pointer program. Memorization breaks down under exam pressure when the question varies slightly.
Is recursion important? Yes. Factorial and Fibonacci recursive programs appear regularly. More importantly, recursion appears as a theory question ("what is recursion, what is the base case, compare with iteration") which is quick marks if you understand it.
Is pointer programming compulsory? Treat it as compulsory. Pointers appear in both theory and practical sections in most papers. The swap-using-pointers program alone is worth practicing until you can write it without thinking.
Is file handling asked every year? Not every year, but consistently enough that it's a calculated risk to skip it. A file handling long question (student records write and read) is 10 marks — that's a significant portion of the theory paper. Most serious students prepare it.
How do I improve coding speed for the practical exam? Practice typing programs regularly, not just reading them. Set a timer — if you can't write bubble sort correctly in under 10 minutes without notes, you need more practice. Speed comes from repetition.
What is the easiest scoring chapter? Structures (Unit 8) has predictable questions (student record program, structure vs union comparison) that are straightforward to prepare. File handling (Unit 10) is also relatively predictable. Both are underestimated by students who focus too heavily on pointers.
Conclusion
C Programming exams at TU reward preparation that's both specific and practical. Knowing which programs appear repeatedly, which comparisons are favourite short questions, and how to allocate your final week is half the preparation. The other half is actually writing those programs until they're automatic.
Use this guide alongside the Complete BSc CSIT C Programming (CSC115) Guide — that one teaches you the concepts; this one tells you what the exam focuses on. Together they cover both learning and exam performance.
For related subjects: DSA (CSC211) Important Questions follows the same format for 3rd semester. Introduction to Information Technology (CSC114) Complete Guide, Digital Logic (CSC116) Complete Guide, and Mathematics-I (MTH117) Guide are the other 1st-semester subjects.

0 Comments