Вы находитесь на странице: 1из 19

AMITY UNIVERSITY MADHYA

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

Course B Tech (CSE)

Batch 2019-2023

Semester 1st Sem

Course Subject Programming for Problem Solving

Course Code CSE-104

Course Credits 03

Syllabus Attached

Question bank Attached

Name of the Faculty


Hemant Kumar Soni (AP-III)
Member, Designation

Name of Assisting/
Re-checking Faculty Mr. Vaibhav Agarwal
Member

Name of the HoD Dr. Venkatadri M. Marriboyina


PROGRAMMING FOR PROBLEM SOLVING

Course Code: CSE 104 Credit Units: 03


Total Hours: 30
Course Objective:
The objective of this course module is to acquaint the students with the basics of computers system, its
components, data representation inside computer and to get them familiar with various important features of
procedure oriented programming language i.e. C.

Course Contents:

Module 1: Introduction to Programming: (03 Hours)


Introduction to components of a computer system (disks, memory, processor, where a program is stored and
executed, operating system, compilers etc.) Idea of Algorithm: steps to solve logical and numerical problems.
Representation of Algorithm: Flowchart/ Pseudocode with examples. From algorithms to programs; source
code, variables (with data types) variables and memory locations, Syntax and Logical Errors in compilation,
object and executable code.

Module 2: Programming Essential: (08 Hours)

Arithmetic expressions and precedence, Conditional Branching and Loop, Writing and evaluation of
conditionals and consequent branching , Iteration and loops.

Module 3: Arrays: (04 Hours)

Arrays (1-D, 2-D), Character arrays and Strings.

Module 4: Basic Algorithms: (3 Hours)

Searching, Basic Sorting Algorithms (Bubble, Insertion and Selection), Finding roots of equations, notion of
order of complexity through example programs (no formal definition required)

Module 5: Function: (03 Hours)

Functions (including using built in libraries), Parameter passing in functions, call by value, Passing arrays to
functions: idea of call by reference

Module 6: Recursion: (03 Hours)


Recursion, as a different way of solving problems. Example programs, such as Finding Factorial, Fibonacci
series, Ackerman function etc. Quick sort or Merge sort.

Module 7: Structure: (02 Hours)


Structures, Defining structures and Array of Structures.

Module8: Pointers: (02 Hours)


Idea of pointers, Defining pointers, Use of Pointers in self-referential structures, notion of linked list (no
implementation)

Module 9: File handling: (02 Hours)


Basics of file Handling.
Course Outcomes:
The student will learn

• To formulate simple algorithms for arithmetic and logical problems.


• To translate the algorithms to programs (in C language).
• To test and execute the programs and correct syntax and logical error
• To implement conditional branching, iteration and recursion.
• To decompose a problem into functions and synthesize a complete program using divide and conquer
approach.
• To use arrays, pointers and structures to formulate algorithms and programs.
• To apply programming to solve matrix addition and multiplication problems and searching and sorting
problems.
• To apply programming to solve simple numerical method problems, namely rot finding of function,
differentiation of function and simple integration

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

Text & References:

• Byron Gottfried, Schaum's Outline of Programming with C, McGraw-Hill


• E. Balaguruswamy, Programming in ANSI C, Tata McGraw-Hill
• Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Prentice Hall of India
SUMMARY OF QUESTIONS

S.N. Module Section –A Section –B Section –C


(6 Marks) (10 Marks) (20 Marks)

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.2 What is dynamic memory allocation?

Q.3 Differentiate between syntax and logical error?

Q.4 What is a pre-processor, What are the advantages of pre-processor ?

Q.5 Define algorithm. Write characteristics of algorithm.


Q.6 Differentiate between algorithm and flowchart.

Q.7Draw a flowchart to find whether the number is even or odd.


Q.8 Draw a flowchart to find greatest number among three numbers.
Q.9 Draw a flowchart to check a number is prime number or not.

Q.10 What do you mean by type conversion? Explain its types.

Q.11What is the difference between a Primary memory and Secondary


memory?

Q.12What is the difference between a volatile memory and a Non-volatile


memory?

Q.13 What is the difference between a ROM and RAM?

Q.14 What are the different problem solving strategies?


MODULE II
Q.15 What is pre increment and post increment ?

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.

Q.26 Write a program to print series of number divisible by 3 from 1 to 100


using for loop.
Q.27 Write a program to find factorial of a number using for loop.
Q.28 Write a program to print Fibonacci series.
Q.29 Write a program to find a number is prime number or not.

Q.30 Write a program to print table of a number given by user.


Q.31 Write a program to find a number is Armstrong number or not.
Q.32 Write a program to print series of number from 1 to 100 those are
divisible by 5 and 7 both.
MODULE III
Q.33 What is the difference between Strings and Arrays?
Q.34 Why is it necessary to give the size of an array in an array declaration ?
Q.35Define array. Explain the basic concept of array.
Q.36 How to initialize array? Explain with example and write its uses.
Q.37 Write a program to print number from 1 to 10 using array and fins sum of
them.
Q.38What are string handlings functions? Explain all with their uses.
Q.39 Write a program to copy one string into another string using strcpy()
function.
Q.40Write a program to concate two string using strcat() function.

MODULE IV
Q.41 What do you understand by time and space complexity of algorithm?

Q.42What is the difference between internal sorting and external sorting.

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?

Q.45Explain the selection sort method with suitable example.

Q.46 What is binary searching? Explain with suitable example


MODULE V
Q.47 What does static variable mean?
Q.48 What is the modular programming ?
Q.49 Difference between formal argument and actual argument ?
Q.50 How to pass array to User defined function. Explain with proper example.
Q.51 What is a function? Why it is needed?
Q.52How value is returned from a function? Discuss in detail.
Q.53What are the rules regarding the naming of a function?
Q.54Why is it necessary to pass the maximum column size of a two
dimensional array to the called function?
Q.55Discuss how multiple values can be returned through a function?

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?

Q.58 Differentiate between recursion and iteration.

Q.59 Design a recursive function of finding factorial of a number .

Q.60 What is recursion? Explain pros and cons of recursion.

Q.61 What is a well defined recursive procedure? Explain

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.

Q.69 Difference between arrays and linked list?

MODULE VIII
Q.70 What are the uses of a pointer?

Q.71 What are the differences between malloc () and calloc ()?

Q.72 What is a NULL Pointer? Whether it is same as an uninitialized pointer?

Q.73 What is an array of pointers ?

Q.74 Can a Structure contain a Pointer to itself?

Q.75 Difference between an array of pointers and a pointer to an array ?

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()?

Q.79 What are the different types of file?

Q.80 Describe the uses and limitations of getc() and putc().

Q.81 Write different modes in file handling.

Q.82 What are the basic file operations?

Q.83 Differentiate between sequential access and random access files.


SECTION –B
MODULE I
Q.1 Write an algorithm and draw flowchart to find factorial of a number.
Q.2 Define flowchart. What are the necessary steps to draw a flowchart?
Q.3 Explain in detail High level, Machine language and Assembly language.

Q.4 What do you mean by C character set, C variable, C constants? Explain in


detail.
Q.5 What do you mean by C keywords, identifier and literals? Explain with
example.
Q.6 Write the basic structure of C program and explain each and every
keyword.
Q.7 What do you mean by data types? How many data types does C language
consist?

Q.8 What is Operating System? Enlist the functions of Operating System.

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.

Q.13 Write a program to find the sum of the series-

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.19 Explain Multi-dimensional character array 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.

Q.22 Sort the following integers using insertion sort-

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.

Q.25 What is binary searching? Write a program in C language for binary


search.

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.28 Write a program in C language to calculate the factorial of a given


number using function

Q.29 Write a function which receives n numbers as an argument and returns


the biggest of a given list of a n values.

Q.30 What do you mean by scope and life of a variable? Explain with the help
of suitable example.

Q.31 What is user defined functions? Explain function prototype through


example.

MODULE VI
Q.32 Write a program using a recursive function to reverse an integer number.

Q.33 What is recursion? Compare recursion and iteration. Give an example


which can be solved by recursion only.

Q.34 Write a program using a recursive function to display Fibonacci series.

Q.35 Write a program using a recursive function for ackerman function.

Q.36 Write a function for quick sort by using recursion.


Q.37 Write a function for merge sort by using recursion.

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.

Q.40 Create structure “Employee” with Eno, name, salary, DOJ.


Read at least 5 records & display records of employees whose salary is more
than 20000.
Q.41 Describe array in structure and array of structure. Is there any difference
between a structure and array?
Q.42 Distinguish between nested structures and array of structures with the
help of suitable example.

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.49 Write a program in C that copy a file to the another file.

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.2 Discuss the following types of errors that may be encountered in a


program- Syntax error, Linker error, Run time error and Logical error

Briefly write the way to handle these errors.

Q.3 What do you mean by program execution? Explain different phases of


program execution?

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.7 What is operator? Explain different types of operator present in C language


with suitable example.
MODULE III
Q.8 Define the term array. How are two-dimensional arrays represented in
memory? Explain how address of an element is calculated in a two dimensional
array.

Q.9 What do you mean by multidimensional array? Write a program in C for


multiplication of two matrices.

Q.10 How are two-dimensional arrays represented in memory? Write a


program in C for addition of two matrices.

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 –

void swap(int *x, int *y) ;

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.20 What is recursion? Explain its advantages and disadvantages. Write a


program using a recursive function to evaluate the factorial of a number.

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.

Q.24 Write a program in C that reads 10 records of student. A student record


consists of roll number, name, and marks. Your program should print the
records of students sorted in the descending order of their marks.

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-

(i) How many characters


(ii) How many words
(iii) How many lines

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.

Вам также может понравиться