0% found this document useful (0 votes)
14 views

Suggestion ES CS 201 Practice

The document outlines a comprehensive curriculum for a C programming course, covering topics such as digital computer architecture, differences between compilers and interpreters, and the advantages and drawbacks of machine language. It includes detailed modules on C language fundamentals, arrays, strings, functions, structures, pointers, file processing, and preprocessor directives, along with numerous exercises and examples for practical understanding. Each module is designed to build foundational knowledge and skills in programming using C.

Uploaded by

rrmm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Suggestion ES CS 201 Practice

The document outlines a comprehensive curriculum for a C programming course, covering topics such as digital computer architecture, differences between compilers and interpreters, and the advantages and drawbacks of machine language. It includes detailed modules on C language fundamentals, arrays, strings, functions, structures, pointers, file processing, and preprocessor directives, along with numerous exercises and examples for practical understanding. Each module is designed to build foundational knowledge and skills in programming using C.

Uploaded by

rrmm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Prof.

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.

4. Discuss the various arithmetic operators available in C. How do precedence and


associativity rules affect the evaluation of expressions?
5. What are constants and literals in C? How are they different from variables? Provide
examples of different types of constants.
6. How do printf and scanf functions work?
7. Explain the use of relational operators and logical connectives in C. How are they used in
decision-making structures like if and if-else statements?
8. Compare and contrast the while, do while, and for loops in C. Provide scenarios where
each type of loop is most appropriately used.
9. What are nested loops in C? Provide an example of a nested loop and explain its use
case.
10. What is an infinite loop? Give an example in C where an infinite loop might be
intentionally used.

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.

12. What is structured programming? How do conditional statements and loops


contribute to structured programming in C?
13. Show, with an example, how a macro is implemented in C?
Module 2:
Arrays: One dimensional arrays: Array manipulation, Searching, Insertion, and Deletion
of an element from an array, finding the largest/smallest element in an array; Two
dimensional arrays, Addition/multiplication of two matrices, transpose of a matrix.
Strings: General concept of string, String declaration and initialization, String input and
output functions, Different in-build string functions – strlen(), strcmp(), strcpy(), strcat()
etc.
Discuss the formation of a variable length 2D array where each row may have different
number of columns.

—--------------------------------------------------------------------------------------------------
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. Show with an example how arguments may be passed to a main function in C.


2. Explain with example how pointer to a structure works.
3. What is a structure in C? How do structure variables differ from regular variables?
4. What are nested structures in C? How are they defined and accessed? Provide an example
to illustrate your explanation.
5. How can structures be passed to functions in C? Discuss both passing by value and
passing by reference with examples.
6. Explain the concept of arrays of structures in C. How are they declared and
initialized? Provide a code example.
7. How can arrays be included as members within a structure in C? Provide an
example to demonstrate this concept.
8. What is a union in C? How does it differ from a structure in terms of memory usage
and member access?
9. Describe how to initialize and use a union in C. Provide an example to illustrate the
initialization and accessing of union members.
10. Compare and contrast structures and unions in C. In what scenarios might you choose to
use a union over a structure?
11. Explain the use of pointers to structures. How do you access members of a structure
using a pointer? Provide a code example.
12. How is dynamic memory allocation performed for structures in C?
13. Write a program in C (using array of structure) to Store the name of 10 books, name
of their authors, their price and their year of publication.
Now take an input year from the user and display the names of books whose year of
publication match the input given year. Also display the total prices of these books.
Example, if there are 3 books as below and input year is 2002:
Name - Book1, Author – Author1, Year of Publication – 2001, Price – 100.00 Name –
Book2, Author – Author2, Year of Publication – 2002, Price – 150.00 Name – Book3,
Author – Author3, Year of Publication – 2002, Price – 200.00 Output should be – Book2,
Book3, 350.00
Module 5:
Pointers: Address operators, Pointers type declaration, Pointer assignment, Pointer
initialization, Pointer arithmetic, Functions and pointers, Arrays and Pointers, Pointer
arrays.

—--------------------------------------------------------------------------------------------------

1. What is the address operator in C? How is it used with pointers? Provide


examples to illustrate its use.
2. Explain how to declare a pointer variable in C. What is the significance of
specifying the type of data a pointer will point to?
3. Discuss the concept of pointer arithmetic in C. How do operations like addition and
subtraction work with pointers? Provide examples.
4. How can pointers be used with functions in C? Explain the concepts of passing pointers
to functions and returning pointers from functions with examples.
5. Explain the relationship between arrays and pointers in C. How can an array be
accessed using pointers? Provide a code example.
6. What is an array of pointers? How is it declared and used in C? Provide an
example to illustrate its usage.
7. What is a pointer to a pointer in C? How is it declared and what are its uses?
8. What is a null pointer, and how is it used to avoid common pointer-related errors?
9. Explain the dynamic memory allocation, re-allocation and de-allocation techniques
in C with suitable examples. Explain the use of malloc, calloc, and free functions with
examples.
10. Differentiate between a constant pointer and a pointer to a constant. Provide examples
to illustrate their usage and constraints.
11. What is pointer dereferencing in C? Explain how it is used to access the value pointed
to by a pointer. Provide an example.
12. What are some common errors encountered when using pointers in C? Discuss issues
like dangling pointers, memory leaks, and invalid pointer dereferencing with examples.
Module 6:
File Processing: Concept of Files, File opening in various modes and closing of a file,
Reading from a file, writing onto a file.

—--------------------------------------------------------------------------------------------------

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.

You might also like