Suggestion ES CS 201 Practice
Suggestion ES CS 201 Practice
Soumen Swarnakar
Contact: 9434842359
Basic:
1. Describe digital computer Architecture with Diagram.
2. Difference between Compiler Interpreter.
3. Advantage and drawbacks of Machine Language.
4. Short Notes: Operating System and their functions, ASCII Codes, CPU
5. Discuss different types of Computer.
6. History of computer generation short notes.
Module 1:
Introduction to C Language: Character set, Variables and Identifiers, Built-in Data Types,
Variable Definition, Arithmetic operators and Expressions, Constants and Literals, Simple
assignment statement, Basic input/output statement, Simple ’C’ programs.
Conditional Statements and Loops: Decision making within a program Conditions,
Relational Operators, Logical Connectives, if statement, if-else statement. Loops: while
loop, do while, for loop, Nested loops, Infinite loops, switch statement, Structured
Programming.
—--------------------------------------------------------------------------------------------------
1. Describe the character set used in C programming. How does the ASCII
character set play a role in C language?
2. List and explain the different built-in data types available in C. Provide examples of each
type.
3. Explain the different types of storage classes in C with suitable examples.
Mention their differences with respect to initialization, scope and lifetime.
11. Describe the switch statement in C. How does it differ from the if-else ladder?
Provide an example where a switch statement is more efficient.
—--------------------------------------------------------------------------------------------------
Arrays
1. Explain the concept of array manipulation. What are the common operations
performed on arrays, and how are they implemented in C?
2. Discuss the methods for searching an element in a one-dimensional array. How does the
linear search algorithm work?
3. Explain the steps involved in inserting an element into a specific position in a one-
dimensional array. Provide a code example.
4. Describe the procedure to delete an element from a one-dimensional array. What
challenges might arise during this operation?
5. How can you find the largest and smallest elements in a one-dimensional array? Illustrate
with a code example.
6. Explain how to declare, initialize, and access elements of a two-dimensional array in C.
Provide an example.
7. Explain the process of estimating the memory location of an arbitrary position (x, y) in a
2-dimentional array.
8. Explain with proper block diagram how a 2-dimensional integer array is stored in the
memory of a computer. What is the advantage of using a dynamic array?
9. Describe the algorithm for adding two matrices using two-dimensional arrays. Include a
code example to demonstrate this operation.
10. How is matrix multiplication performed using two-dimensional arrays in C?
Provide the necessary steps and a code example.
11. Explain the process of finding the transpose of a matrix using two-dimensional arrays.
Provide a code example to illustrate the transpose operation.
12. Given a list of „n‟ distinct positive integers in random order write a program in C, using
array and function, to find and display the largest even and odd integer from the list.
Strings
13. What is a string in C? How is it different from a character array? Explain how to
declare and initialize strings in C. Provide examples to illustrate different methods.
14. Write a C function to print a digit into word
15. Describe the functions used for string input and output in C. How do gets() and puts()
functions work?
16. What does the strlen() function do in C? Provide a code example demonstrating its
usage.
17. Explain the strcmp() function. How is it used to compare two strings? Provide an
example.
18. Describe the strcpy() function. How is it used to copy one string to another?
Illustrate with a code example.
19. What is the purpose of the strcat() function in C? Provide an example showing how to
concatenate two strings using this function.
20. Discuss the importance of string manipulation in programming. What are some common
string operations and how are they performed in C?
21. Compare and contrast string literals and character arrays in C. How are they stored
and accessed differently?
22. Explain the potential issues that can arise when handling strings in C, such as buffer
overflows. How can these issues be mitigated?
23. Write a program in C (using pointers, array and function) to sort an input string of N alpha
characters (N is odd without blank space) in such a way that the output string is a rotation
around its middle character. Example, if input is “HELLO”, output should be: “OLLEH”
Module 3:
Functions: Top-down approach of problem solving; Modular programming and functions;
Standard Library of C functions; Prototype of a function Formal parameter list, Return
Type, Function call, Block structure; Passing arguments to a Function Call by reference,
Call by value, Recursive Functions, Arrays as function arguments.
—--------------------------------------------------------------------------------------------------
1. What is the top-down approach in problem-solving? How does it differ from the bottom-
up approach? Provide examples to illustrate the top-down approach.
2. Explain the concept of modular programming. How does modular programming enhance
code readability and maintainability in C?
3. Define the term 'function prototype' in C. What is a formal parameter list in a function
definition? How is the return type of a function specified, and why is it important?
4. What does 'call by value' mean in C? How does this method of passing
arguments to a function work, and what are its implications?
5. Describe the 'call by reference' method of passing arguments to a function in C. How
does it differ from 'call by value'?
6. Provide a comparative analysis of 'call by value' and 'call by reference' in C with code
examples showing their differences in behavior.
7. What is a recursive function in C? Explain with an example how recursion works and
discuss the concept of base cases and recursive cases.
8. Write programs in C using both tail-recursive and non-tail-recursive functions to find
factorial of a given positive integer N.
9. How are arrays passed to functions in C? What considerations must be taken into account
when using arrays as function arguments?
10. Write a function to calculate your age from the input date of birth (in dd-mm-yy) format.
11. Although C does not support function overloading directly, explain the concept and
how function overloading can be emulated in C using different techniques.
12. Given n distinct positive integers (n > 2), write a program in C using recursive
function to find their LCM (Lowest Common Multiple).
Module 4:
Structures and Unions: Structure variables, Initialization, Structure assignment, Nested
structure, Structures and Functions, Structures and arrays: Arrays of structures,
Structures containing arrays, Unions.
—--------------------------------------------------------------------------------------------------
—--------------------------------------------------------------------------------------------------
—--------------------------------------------------------------------------------------------------
1. What is a file in the context of C programming? How does file handling in C differ from
in-memory data handling?
2. Write the prototypes of any four file operations in C for reading from and writing to a
file.
3. Explain the different modes available for opening a file in C. What are the
purposes of modes such as r, w, a, r+, w+, and a+?
4. Why is it important to close a file after operations are completed? What function
is used to close a file in C and what happens if a file is not closed properly?
5. What is a file pointer in C? How is it used in file operations such as reading,
writing, and seeking?
6. Describe the process of opening a file in read mode in C. What happens if the file does
not exist?
7. What functions are used to read data from a file in C? Explain the use of fgetc,
fgets, and fread with examples.
8. Explain what happens when a file is opened in write mode in C. What is the effect on the
file if it already exists?
9. What functions are used to write data to a file in C? Describe the use of fputc,
fputs, and fwrite with examples.
10. How does opening a file in append mode differ from write mode? What is the effect
of using a or a+ modes on an existing file?
11. Write a program in C using file operation to read a sentence from a given input
file and display the number of words in the sentence. Write this number in the given file as
well. Assume that the file has only ONE sentence ending with a
full-stop.
Example, if the file is Test.txt and the sentence in the file is “It is Sunday today.”, the
output should be 4 and it should be written back into the file Test.txt
12. Write a short program to insert your name at the different positions (beginning, middle,
end) of a text file.
PREPROCESSOR
1. What is Preprocessor? What are the preprocessor directives explain with examples.