Government Engineering College Bhavnagar
Computer Engineering Department
Programming Assignments (A.Y. 2024-25)
Subject Name & Code: PROGRAMMING FOR PROBLEM SOLVING (BE01000121)
Submission Deadline: 26/04/2025
For all students
Section 1: Theory Questions
1. Draw a block diagram of computer system. Explain each component in detail
2. What is Software? Explain types of software
3. Differentiate between Interpreter and Compiler
4. What is C language? Discuss its features.
5. Explain different data types in C with examples.
6. What is the difference between printf() and scanf()?
7. What are loops in C? Explain different types of loops with syntax.
8. Explain break and continue in Loop.
9. Differentiate between entry controlled loop and exit controlled loop.
10.Define an array and explain its types with examples.
11.Explain the difference between call by value and call by reference with
examples.
12.What are pointers? How are they used in C?
13.Write a short note on structures and unions in C.
14.Explain file handling in C with suitable examples.
15.What is the difference between while and do-while loops?
Section 2: Programming Questions
1. Basic Programs
1. Write a C program to print "Hello, World!".
2. Write a C program to add two numbers entered by the user.
3. Write a C program to swap two numbers without using a third variable.
4. Write a C program to check if a number is even or odd.
2. Control Statements
5. Write a C program to find the largest number among three numbers using if-else.
6. Write a C program to check if a given number is prime.
7. Write a C program to display the Fibonacci series up to n terms.
8. Write a C program to find the factorial of a number using recursion.
3. Arrays and Strings
9. Write a C program to find the sum of all elements in an array.
10.Write a C program to reverse a string without using built-in functions.
4. Functions and Pointers
11.Write a C program to swap two numbers using pointers.
12.Write a C program to find the sum of two numbers using a function.
5. Advanced Concepts
(A)Write a C program to implement a simple calculator using a switch case.
(B)Write a C program to read and write data to a file.
(C)Write a C program to store student details using structures and display them.
Guideline for assignments
● All the programs must be hand-written with output of at least 3 different inputs on
a specific program. Your first input must be your last two digits of enrollment
number).
● Give Proper naming to variables
o For example enrollment number 240210107001 wants to create three int
variables in program like int a,b,c; then his/her variable name must be
int a_raj_01, b_raj_01, c_raj_01;
o Similarly, naming convention for enrollment number 240210107031 for
two int and 1 float variables in program is;
int radious_aay_31, i_aay_31, j_aay_31;
float area_aay_31;
Extra Assignments for students who have secured less than 10 marks
in the Quiz: Last Two year GTU question papers (Summer 2024 and Summer 2023)
Extra Assignments for students who have secured marks equal to or
greater than 10 in the Quiz.
1. Write a C Program to find Largest Element of an Integer Array. Here the number of
elements in the array ‘n’ and the elements of the array is read during runtime.
2. Write a C Program to print the array elements in reverse order (Not reverse sorted
order). Just the last element will become first element, second last element will
become second element and so on)
3. Write a C program to find subtraction of two matrices i.e. matrix_A - matrix_B =
matrix_C.
If the given matrix are
235 and 1 5 2
456 2 3 4
657 3 3 4
Then the output will be
1 -2 3
2 2 2
3 2 3
(The elements of the output matrix are separated by one blank space)
4. Write a C program to print a triangle of prime numbers up to given number of lines of
the triangle. e.g If number of lines is 3 the triangle will be
2
3 5
7 11 13
5. Write a program to print all the locations at which a particular element (taken as
input) is found in a list and also print the total number of times it occurs in the list.
The location starts from 1.
For example if there are 4 elements in the array
5
6
5
7
If the element to search is 5 then the output will be
5 is present at location 1
5 is present at location 3
5 is present 2 times in the array.