Академический Документы
Профессиональный Документы
Культура Документы
PRADESH, GWALIOR
QUESTION BANK
OF
PROGRAMMING FOR PROBLEM SOLVING
CSE-104
PREPARED BY
HEMANT KUMAR SONI
Assistant Professor III
Department of Computer Science & Engineering
Amity School of Engineering & Technology
AMITY UNIVERSITY MADHYA PRADESH, GWALIOR
June 2019
AMITY SCHOOL OF ENGINEERING & TECHNOLOGY (ASET)
META DATA : QUESTION BANK
Batch 2019-2023
Course Credits 03
Syllabus Attached
Name of Assisting/
Re-checking Faculty Mr. Vaibhav Agarwal
Member
Course Contents:
Arithmetic expressions and precedence, Conditional Branching and Loop, Writing and evaluation of
conditionals and consequent branching , Iteration and loops.
Searching, Basic Sorting Algorithms (Bubble, Insertion and Selection), Finding roots of equations, notion of
order of complexity through example programs (no formal definition required)
Functions (including using built in libraries), Parameter passing in functions, call by value, Passing arrays to
functions: idea of call by reference
Examination Scheme:
Components A CT S/V/Q/HA EE
Weightage (%) 5 15 10 70
CT: Class Test, HA: Home Assignment, S/V/Q: Seminar/Viva/Quiz, EE: End Semester Examination; A:
Attendance
1 I 14 08 04
2 II 18 06 03
3 III 08 06 04
4 IV 06 05 04
5 V 09 06 03
6 VI 06 06 03
7 VII 08 05 03
8 VIII 08 04 03
9 IX 06 04 03
TOTAL 83 50 30
SECTION-A
MODULE I
Q.1 Elaborate the components of a Computer System?
Q.16 Write a program to interchange 2 variables without using the third one.
Q.17 Write a program to swap two numbers without using third variable.
Q.18 Write a program to swap two numbers using third variable.
Q.19 What are decision control statements in C? Explain all with example.
Q.20 Write a program to find a number is even or odd.
Q.21 Write a program to find year is leap year or not.
Q.22 Write a program to find greatest number among three numbers using
nested if else.
Q.23 Write a program to print sum of digits of a number using modulus
operator.
Q.24 Write a program to print reverse of a number.
Q.25 Write a program that shows concept of switch case.
MODULE IV
Q.41 What do you understand by time and space complexity of algorithm?
Q.43 Write an algorithm for bubble sort. What is the complexity of this
algorithm?
Q.44 Write the algorithm for insertion sort. How many key comparisons are
made in its worst case?
MODULE VI
Q.56 Write about different types of recursion. When recursion should be
avoided?
Q.57 What are the different points which a function must have for good and
efficient recursive program?
MODULE VII
Q.62 What are the differences between structures and arrays?
Q.63 Define structure and explain how it differs from other data types.
Q.64 How to initialize and access member of structure? Explain with example.
Q.65 Write a program that shows concept of structure.
Q.66 How to declare structure? Write uses of structure.
Q.67 What do you mean by array of structure? Explain with example.
Q.68 Write a program that shows the concept of array of structure.
MODULE VIII
Q.70 What are the uses of a pointer?
Q.71 What are the differences between malloc () and calloc ()?
Q.76 What are the advantages of using array of pointers to string instead of an
array of strings?
Q.77 Differentiate between arrays and linked list?
MODULE IX
Q.78 How would you use the functions fseek(), freed(), fwrite() and ftell()?
MODULE II
Q.9 What do you understand by associativity of operators? Explain through
suitable example.
Q.10What are loop control structures? Explain for loop, while loop and do-
while loop with
their syntax.
Q.11Explain break, continue and goto statement with example and their use.
Q.12Write a program that reads a four digits positive integer number and
prints the sum of all digits in it . Your program should be well documented with
comments and prompts for input.
S= 1+ x/1! +x2/2!+x3/3!+...................................
Up to desired accuracy entered to the program as input and value of x will also
be entered as input.
Q.14 Write a program in C language in which take input of marks (out of 100) in
5 subjects and display grade according to following table:-
Percentage Grades
>=80 A+
>=75 A
>=60 B
>=45 C
>=35 D
<35 Fail
MODULE III
Q.15 Explain need of array variable. What is the difference between character
array and numeric array.
Q.16 Write a program to find maximum and minimum number from an array
of 10 elements.
Q.17 Define 2-D array with its syntax and explain how to initialize 2-D array.
Q.18 How 1-D and 2-D array elements are stored in memory/ Explain with
example.
Q.20 What are string handlings functions? Explain all with their uses.
MODULE IV
Q.21 What is sequential searching? Write a program in C language for
sequential search.
25,57,48,37,12,92,86,33
Q.23 Write a program in C language for finding roots of equation.
Q.24 What do you mean by asymptotic notation for complexity? Explain with
suitable example.
MODULE V
Q.26 What is storage class. What are the different storage classes in C?
Q.27 Classify the functions according to arguments passed and returned value.
Q.30 What do you mean by scope and life of a variable? Explain with the help
of suitable example.
MODULE VI
Q.32 Write a program using a recursive function to reverse an integer number.
MODULE VII
Q.38 Create structure “Cricket” with following fields:
Player_Name, Team_Name, Average
Use proper data types. Read 5 players records and display them in formatted
manner.
Q.39 Create a structure “Customer” with fields like CustNo, Name, Address,
and Email.
Take an array of structure and input the values for member variables and
display it in
proper format.
MODULE VIII
Q.43 Write a program using pointers to read in an array of integers and print
its elements in reverse order of index.
Q.44 What do you mean by linked list? Give the advantages and disadvantages
of linked lists.
Q.45 How a linked list can be implemented using arrays? Enlist and describe
various operations performed on linked list.
Q.46 Explain the implementation of linked list using arrays and dynamic
memory allocation.
MODULE IX
Q.47Describe two different approaches of updating a data file. Which
approach is better and why?
Q.48 How can random accessing be supported in files? Discuss the seek()
function in details in this context.
Q. 50 What is a file mode? Describe the various file mode options available.
SECTION-C
MODULE I
Q.1 Define algorithm and write characteristics of a good program. How a
program can be made robust? What do you understand by structured
programming?
Q.4 What is a flow chart? Explain different symbols use to construct flowchart?
Draw a flowchart for calculating the simple interest and also write algorithm
for it.
MODULE II
Q.5 What is switch.... case statement? What are the advantages and
drawbacks of switch.....case statement? Write the importance of break and
default keywords. Write a program to demonstrate it.
Q.6 What are standard and user defined data types in C? Specify memory
requirement of standard data types of C language? Explain the concept of
identifiers and literals.
Q.11 Write a program in C language that reads a square matrix and prints
whether this matrix is symmetric or not.
MODULE IV
Q.12 What is selection sort? Write a program in C language to implement the
concept of selection sort algorithm. Sort following values by selection sort
25,57,48,37,12,92,86,33
Q.13 Explain binary search method. Write C function for recursive and non-
recursive implementation of binary search. Compare these implementations in
terms of time and memory requirements.
Q.14 Write a program in C language for insertion sort. Sort following number
using insertion sort 15, 8,56,26,67,12,48,84,92,73
Q.15 Write a program in C language for bubble sort. Sort following number
using bubble sort 32,51,27,85,66,23,13,57
MODULE V
Q.16 Discuss the concept of call by value and call by reference parameter
passing. Design a function to swap two variables. The prototype may be –
Q.17 What do you understand by scope, lifetime and visibility of the variables?
What are the advantages of modular programming?
Q.18 Write a program to compute the sum and product of two matrices. Use
different functions to perform each task. Pass the arrays as parameters.
MODULE VI
Q.19 What is a quick sort algorithm? Write a program in C language to
implement quick sort algorithm. Sort the following values using quick sort
and explain the steps-
65,70,75,80,85,60,55,50,45
Q.21 What is recursion? Compare and contrast recursion and iteration and
write a function power(a,b) to calculate ab using recursion considering a and b
as integer arguments.
MODULE VII
Q.22 What do you mean by structure? Use structure to store data about 10
books. In your program data about book contains book title, price, and number
of copies of the book. After reading the data about books, your program
should display the data of all the books which cost more than Rs.500.
Q.23 Is there any difference between a structure and an array? Create a
structure called weight whose data members are kilogram (float), gram (float)
and milligram(int). Initialize two structure members and add these members.
Print added values.
MODULE VIII
Q.25 What are self referential structures? Write a program in C to display the
use of self-referential structure.
Q.26 What is the concept of linked list? Explain and write an algorithm to insert
a node into a linked list (taking all the cases).
Q.27 What is meant by linked list? What are its advantages? Write an
algorithm which counts the number of nodes in a linked list.
MODULE IX
Q.28 Explain various file handling functions in C language. Write syntax and
examples of each.
Q.29 Describes the file handling. Write a program in C language that will read a
file having text and prints the following information about the file that it
contains-
Q.30 Write a program in C that creates a data file containing employee code,
employee name, basic salary, and DA. Write 20 records on the file, now open
the file, read the basic salary of each, increase it by 18%. Display the employee
name and increased salary.