IMPORTANT C Programming QUESTION

GYAN WALLA
13 minute read
0

 



Master C Programming: Past Year Questions Guide for CSIT First Semester

Welcome CSIT First Semester students! C Programming is a foundational course for your degree. To help you prepare effectively, we've compiled a chapter-wise guide of past year questions (PYQs) from 2074 to 2081 for your C Programming (CSC115) course at Tribhuvan University. Use this resource to understand the exam pattern, focus your studies, and boost your exam performance.


This was kindly shared by a fellow BSc CSIT student. I’m truly grateful to them for providing this valuable resource. I had asked to credit them by mentioning their name and college, but they preferred to stay anonymous and requested not to include either.

Feel free to reach out if you ever wish to share helpful information like this! We’d be happy to give you credit in whatever way you prefer—by mentioning your name and college, just your name, or only your college name. Your contribution could help many others!

📩 You can contact me at: madhav.paudel40400@gmail.com


Course Overview

Get a quick overview of the C Programming course structure:

  • Course Title: C Programming
  • Course Code: CSC115
  • Semester: I
  • Nature: Theory + Lab
  • Full Marks: 60 (Theory) + 20 (Practical) + 20 (Internal Assessment)
  • Pass Marks: 24 (Theory) + 8 (Practical) + 8 (Internal Assessment)
  • Credit Hours: 3
  • Description: Covers structured programming concepts using the C language.
  • Objective: Familiarize students with C programming techniques.

Syllabus Units

The C Programming syllabus is divided into 11 units:

  1. Unit 1: Problem Solving with Computer (2 Hrs.)
  2. Unit 2: Elements of C (4 Hrs.)
  3. Unit 3: Input and Output (2 Hrs.)
  4. Unit 4: Operators and Expression (4 Hrs.)
  5. Unit 5: Control Statement (4 Hrs.)
  6. Unit 6: Arrays (6 Hrs.)
  7. Unit 7: Functions (5 Hrs.)
  8. Unit 8: Structure and Union (5 Hrs.)
  9. Unit 9: Pointers (6 Hrs.)
  10. Unit 10: File Handling in C (4 Hrs.)
  11. Unit 11: Introduction to Graphics (3 Hrs.)

Past Year Questions by Syllabus Unit

Unit 1: Problem Solving with Computer

  • What is algorithm? How is it different from flow chart? (2074, 5 marks)
  • Explain flowchart with example. What are the benefits of using flowcharts? (2077, 5 marks)
  • Discuss structure of a C Program with suitable example. (2078, 5 marks)
  • Explain the basic structure of C Programming. (2081, 5 marks)
  • Write short notes on: Compilation and execution. (2077, part of 5 marks)
  • Write short notes on: Debugging. (2081, part of 5 marks)

Unit 2: Elements of C

  • Discuss structure of a C Program with suitable example. (2074, 10 marks)
  • Write short notes on: History of C. (2078, part of 5 marks)
  • What is data type? Why do we need it in programming? Explain any three basic data types with example. (2077, 5 marks)
  • What is variable? How is it different from constant? How do you write comments in C? (2078, 5 marks)
  • Differentiate between constant and literals. Why do we need to define the type of data? (2079, 5 marks)
  • Differentiate between source code and object code. (2080, part of 10 marks)

Unit 3: Input and Output

  • What do you mean by unformatted I/O? Explain. (2077, 5 marks)
  • Explain formatted I/O functions in detail. (2078, 5 marks)
  • Describe the different types of I/O functions used in file handling with syntax. (2080, 5 marks)
  • Describe different formatted input and output functions. Why do we use them? (2081, 5 marks)

Unit 4: Operators and Expression

  • Discuss increment and decrement operators with example. (2074, 5 marks)
  • Discuss different logical operation in detail. (2075, 5 marks)
  • Write short notes on: Operator precedence and associativity. (2077, part of 5 marks)
  • Write short notes on: Bitwise Operator. (2078, part of 5 marks)
  • List different types of operators and explain any three of them. (2080, 5 marks)
  • List different types of operators and explain any four of them. (2081, 10 marks)
  • Write short notes on: Conditional Operator. (2079, part of 5 marks)

Unit 5: Control Statement

  • Discuss different types of if statements with example of each. Differentiate if statement with switch statement. (2074, 10 marks)
  • What is looping statement? Discuss different looping statements with suitable example of each. (2075, 10 marks)
  • What is break statement? Discuss with example. How the break statement is different from continue statement? (2075, 5 marks)
  • What do you mean by looping? Explain while loop with suitable example. Compare while loop with do-while loop. Write a program to find sum and average of first n natural numbers. (2077, 10 marks)
  • What do you mean by jump statement? Explain each jump statement with example. Write a program to check whether a number entered is prime or not. (2078, 10 marks)
  • Why do we need a break and continue statement? Define formal argument and actual argument in function with examples. Identify and list the errors in the following code.
    
      int main(){
          int a,b,c
          scanf("%d%d%d, &a, &b, &c);
          sum(a, b, c);
          return -1;
      }
      void sum(int x, int y, int z){
          int sum;
          sum = a + b + c;
          return sum;
      }
            
    (2079, part of 10 marks)
  • Write a program to demonstrate the following menu-driven program. The user will provide an integer and alphabet for making choice and the corresponding task has to be performed according as follows: Find Odd or Even, Find Positive or Negative, Find the Factorial value, Exit. The choice will be displayed until the user gives “D” as a choice. (2079, 10 marks)

Unit 6: Arrays

  • Write a program to find sum and average of 10 integer numbers stored in an array. (2074, 5 marks)
  • Define array? What are the benefits of using array? Write a program to add two matrices using array. (2075, 10 marks)
  • What are the benefits of using arrays? Compare one dimensional array with two dimensional array. Write a program to find transpose of a matrix. (2077, 10 marks)
  • Explain any three string functions. Write a program to check if two matrices are identical or not. (2078, 10 marks)
  • Write a program to find the second largest number in the given array of numbers. (2079, 5 marks)
  • Write a program to read P*Q matrix of integers and find the largest integer of each row and display it. (2080, 5 marks)
  • Write a program to initialize an array of dimension 10 and sort the numbers within the array in ascending order. (2080, 5 marks)
  • What are the characteristics of array? Write a program to input age of 500 persons and display the following: Average age, Age between 25 to 30. (2081, 10 marks)

Unit 7: Functions

  • What is function? Discuss the benefits of using function. (2074, 5 marks)
  • Write a program to find product of two integers using your own function. (2077, 5 marks)
  • Write a program using your own function to find sum of two numbers. (2078, 5 marks)
  • Define formal argument and actual argument in function with examples. (2079, part of 10 marks)
  • Write a program to find the sum of digits of a given integer using recursion. (2079, 5 marks)
  • Write a program to calculate the factorial of a given number using recursion. (2080, 5 marks)
  • Write a program to compute the sum of first 10 even numbers using function. (2080, 5 marks)
  • Differentiate between library function and user-defined function. Write a program to swap two values using call by reference concept. (2081, 10 marks)
  • Demonstrate the use of recursive function with a suitable example. (2081, 5 marks)
  • Write short notes on: Local, Global, and Static variables. (2079, part of 5 marks)

Unit 8: Structure and Union

  • What is structure? How is it different from array? Create a structure student having data members name, roll-number, and percentage. Complete the program to display the name of student having percentage greater than or equal to 60. (2074, 10 marks)
  • What is structure? Create a structure rectangle with data members length and breadth. (2075, 5 marks)
  • What is structure? How is it different from union? Create a structure named course with name, code, and credit_hour as its members. Write a program using this structure to read data of 5 courses and display data of those courses with credit_hour greater than 3. (2077, 10 marks)
  • Define structure. Explain nested structure with example. Create a structure named book with name, author, and publisher as its members. Write a program using this structure to read data of 50 books and display name of those books published by “XYX” publisher. (2078, 10 marks)
  • Create a structure “Employee” having Name, Address, Salary, and Age as member functions. Display the name of the employee having aged between 40 and 50 and living in Kathmandu. (2079, 5 marks)
  • What is the advantage of the union over structure? List any four string library functions with the prototype. (2079, 5 marks)
  • Define structure and nested structure. (2080, part of 10 marks)
  • Create a structure named Book with members Book_Name, Price, and Author_Name, then take input for 10 records of Book and print the name of authors having the price of book greater than 1000. (2080, 10 marks)
  • Create a structure called STUDENT with data members SID, name, address, CGPA. Write a program to initialize the value of 100 students and display the information of those students whose address is “KTM” and CGPA is between 3.5 to 4 using C program. (2081, 5 marks)

Unit 9: Pointers

  • Define pointer. Discuss the relationship between pointer and one-dimensional array. (2074, 5 marks)
  • Define pointer. How do you return pointers from functions? Explain with example. (2077, 5 marks)
  • List any one advantage and disadvantage of the pointer. How do you pass pointers as function arguments? (2079, 5 marks)
  • Explain the relation to array and pointer. Differentiate call by value and call by reference with a suitable program. (2080, 10 marks)
  • What is dynamic memory allocation? Explain with a suitable program. (2080, 5 marks)

Unit 10: File Handling in C

  • Write a program to read and print data stored in a file input.txt. (2074, 5 marks)
  • Why do we need data files? What are the different file opening modes? Write a program that reads data from a file “input.txt” and writes to “output.txt” file. (2075, 10 marks)
  • Explain different file I/O functions with example. (2077, 5 marks)
  • Write a program that simply reads data from a file. (2078, 5 marks)
  • Suppose a file named “Num.txt” contains a list of integers. Write a program to extract the prime numbers only from that file and write them on “Prime.txt” file. (2079, 5 marks)
  • Describe the different types of I/O functions used in file handling with syntax. (2080, 5 marks)
  • Explain different file opening modes. (2081, 5 marks)
  • Write short notes on: Benefits of data files. (2075, part of 5 marks)

Unit 11: Introduction to Graphics

  • Why do we need graphics functions? Write a program to draw a circle. (2074, 5 marks)
  • Write short notes on: Graphics functions. (2075, part of 5 marks)
  • Write a program to draw a circle using graphics function. (2077, 5 marks)
  • Write a program to draw a line using graphics function. (2078, 5 marks)
  • Write a program to draw two shapes of your choice using graphics function. (2081, 5 marks)

Additional Programming Exercises

Practice these general programming questions that cover concepts from multiple units:

  • Write a program that computes the sum of digits of a given integer number. (2074, 5 marks)
  • Write a program to check whether a number entered is even or odd. (2075, 5 marks)
  • Write a program to calculate sum of first 10 odd numbers. (2075, 5 marks)
  • Write a program to display first n prime numbers. (2077, 5 marks)
  • Write a program to print largest among three numbers entered by the user. (2078, 5 marks)
  • How do you swap the values of two integers without using the third temporary variable? Justify with the example. (2079, 5 marks)
  • Write a program to check whether the entered word is palindrome or not. (2080, 5 marks)
  • Trace the output of the following code:
    
      #include
      #include
      void main(){
          int i = 0, k;
          for(k = 5; k >= 0; k--){
              i = i + k;
          }
          printf("%d\t", i);
          getch();
      }
            
    (2080, 5 marks)
  • Write a program to display first 50 prime numbers. (2081, 5 marks)
  • Write a program to display the following series up to 25 terms but do not print the 7th term: 2 x 3, 3 x 5, 4 x 7, 5 x 9… (2081, 5 marks)

This comprehensive guide of past year C Programming questions is designed to be your ultimate study companion. Practice these questions unit by unit to build a strong foundation and excel in your exam. Best wishes for your C Programming exam!

Post a Comment

0Comments

Post a Comment (0)