1
ArulmiguMeenakshi Amman College of Engineering
Vadamavandal-604410.
Important questions and answers
CS25C01-Computer Programming: C
Prepared by
V.Umapathy,
Prof. /Mech.
S.N Question Answer
o
Syllabus
S.No. Description
1 Introduction to C: Problem Solving, Problem Analysis Chart, Developing an
Algorithm, Flowchart and Pseudocode, program structure, Compilation & Execution
process, Interactive and Script mode, Comments, Indentation, Error messages,
Primitive data types, Constants, Variables, Reserved words, Arithmetic, Relational,
Logical, Bitwise, Assignment, Conditional operators, Input/Output Functions, Built-in
Functions.
Practical: Create Problem Analysis Charts, Flowcharts and Pseudocode for simple C
programs (Minimum three).
2 Control Structures: if, if-else, nested if, switch-case, while, do-while, for, nested
loops, Jump statements.
Practical: Usage of conditional logics in programs. (Minimum three)
3 Functions: Function Declaration, Definition and Calling, Function Parameters and
Return Types, Call by Value and Call by Reference, Recursive Functions, Scope and
Lifetime of Variables, Header files and Modular Programming.
Practical: Usage of functions in programs. (Minimum three)
4 Strings & Pointers: One-dimensional and Multi-dimensional Arrays, Array
operations and traversals, String Handling: String declaration, input/output, string
library functions, Pointer arithmetic, Pointers and Arrays, Pointers to function,
Dynamic memory allocation.
Practical: Programs using pointers, dynamic memory, pointer arithmetic, string
manipulations, array operations. (Minimum three)
5 Structures & Unions: Defining and using structures, Array of structures, Pointers to
structures, Unions and their uses, Enumerations.
Practical: Program to use structures and unions
6 File Operations: Open, read, write, close file operations, Binary vs Text files, File
pointers, Error handling in file operations.
, 2
Practical: Programs reading/writing data in text and binary files (Minimum three).
7 Standard Libraries & Header Files: Using standard libraries like stdio.h, stdlib.h,
string.h, math.h, Creating and using user-defined header files and libraries.
Practical: Use of standard and user-defined libraries in solving problems. (Minimum
three), Project (Minimum Two)
Unit-I
Introduction to C
Two mark Question and Answers
1. Introduction to C:
C is a fundamental programming language that is widely used for developing operating
systems, embedded systems, and other applications. It is a low-level, compiled language
that provides direct access to hardware resources.
Problem Solving:
Problem solving in C involves identifying a problem, analyzing it, and developing a
solution using C programming language. The steps involved in problem solving are:
1. Problem Analysis: Identify the problem, understand the requirements, and define the
problem clearly.
2. Algorithm Development: Develop an algorithm to solve the problem, which is a step-by-
step procedure for solving the problem.
3. Flowchart and Pseudocode: Create a flowchart and pseudocode to visualize the
algorithm and represent it in a human-readable format.
4. Coding: Write the C code based on the algorithm, flowchart, and pseudocode.
Problem Analysis Chart:
A problem analysis chart is a tool used to analyze a problem and identify the inputs,
outputs, and processing required to solve it. The chart typically includes the following
components:
1. Problem Statement: A clear statement of the problem.
2. Inputs: The data required to solve the problem.
3. Outputs: The expected results of the problem.
4. Processing: The steps required to solve the problem.
, 3
Developing an Algorithm:
An algorithm is a step-by-step procedure for solving a problem. The characteristics of an
algorithm are:
1. Finiteness: An algorithm must terminate after a finite number of steps.
2. Definiteness: An algorithm must have clear and unambiguous instructions.
3. Input: An algorithm must have input data.
4. Output: An algorithm must produce output.
5. Effectiveness: An algorithm must be effective in solving the problem.
Flowchart and Pseudocode:
A flowchart is a graphical representation of an algorithm, while pseudocode is a human-
readable representation of an algorithm.
1. Flowchart: A flowchart uses symbols and arrows to represent the flow of control and
data.
2. Pseudocode: Pseudocode uses a simplified language to represent the algorithm.
Program Structure:
A C program typically consists of the following components:
1. Preprocessor Directives: Instructions to the preprocessor to include header files and
define macros.
2. Global Variables: Variables that are accessible throughout the program.
3. Functions: Blocks of code that perform specific tasks.
4. Main Function: The entry point of the program.
Compilation & Execution Process:
The compilation and execution process involves the following steps:
1. Preprocessing: The preprocessor reads the source code and includes header files and
expands macros.
2. Compilation: The compiler translates the source code into object code.
3. Linking: The linker links the object code with libraries and produces an executable file.
4. Execution: The executable file is executed by the computer.
, 4
Interactive and Script Mode:
C can be used in interactive mode, where commands are executed immediately, or script
mode, where a script file is executed.
1. Interactive Mode: Commands are executed immediately, and results are displayed.
2. Script Mode: A script file is executed, and results are displayed.
Comments, Indentation, Error Messages:
1. Comments: Comments are used to document the code and are ignored by the compiler.
2. Indentation: Indentation is used to improve the readability of the code.
3. Error Messages: Error messages are displayed when the compiler encounters an error in
the code.
Primitive Data Types:
C supports the following primitive data types:
1. int: Integer data type.
2. char: Character data type.
3. float: Floating-point data type.
4. double: Double-precision floating-point data type.
Constants, Variables, Reserved Words:
1. Constants: Constants are values that do not change during the execution of the program.
2. Variables: Variables are used to store values that can change during the execution of the
program.
3. Reserved Words: Reserved words are keywords that have special meaning in C and
cannot be used as variable names.
Operators:
C supports the following operators:
1. Arithmetic Operators: +, -, *, /, %
2. Relational Operators: ==, !=, <, >, <=, >=
3. Logical Operators: &&, ||, !
4. Bitwise Operators: &, |, ^, ~
ArulmiguMeenakshi Amman College of Engineering
Vadamavandal-604410.
Important questions and answers
CS25C01-Computer Programming: C
Prepared by
V.Umapathy,
Prof. /Mech.
S.N Question Answer
o
Syllabus
S.No. Description
1 Introduction to C: Problem Solving, Problem Analysis Chart, Developing an
Algorithm, Flowchart and Pseudocode, program structure, Compilation & Execution
process, Interactive and Script mode, Comments, Indentation, Error messages,
Primitive data types, Constants, Variables, Reserved words, Arithmetic, Relational,
Logical, Bitwise, Assignment, Conditional operators, Input/Output Functions, Built-in
Functions.
Practical: Create Problem Analysis Charts, Flowcharts and Pseudocode for simple C
programs (Minimum three).
2 Control Structures: if, if-else, nested if, switch-case, while, do-while, for, nested
loops, Jump statements.
Practical: Usage of conditional logics in programs. (Minimum three)
3 Functions: Function Declaration, Definition and Calling, Function Parameters and
Return Types, Call by Value and Call by Reference, Recursive Functions, Scope and
Lifetime of Variables, Header files and Modular Programming.
Practical: Usage of functions in programs. (Minimum three)
4 Strings & Pointers: One-dimensional and Multi-dimensional Arrays, Array
operations and traversals, String Handling: String declaration, input/output, string
library functions, Pointer arithmetic, Pointers and Arrays, Pointers to function,
Dynamic memory allocation.
Practical: Programs using pointers, dynamic memory, pointer arithmetic, string
manipulations, array operations. (Minimum three)
5 Structures & Unions: Defining and using structures, Array of structures, Pointers to
structures, Unions and their uses, Enumerations.
Practical: Program to use structures and unions
6 File Operations: Open, read, write, close file operations, Binary vs Text files, File
pointers, Error handling in file operations.
, 2
Practical: Programs reading/writing data in text and binary files (Minimum three).
7 Standard Libraries & Header Files: Using standard libraries like stdio.h, stdlib.h,
string.h, math.h, Creating and using user-defined header files and libraries.
Practical: Use of standard and user-defined libraries in solving problems. (Minimum
three), Project (Minimum Two)
Unit-I
Introduction to C
Two mark Question and Answers
1. Introduction to C:
C is a fundamental programming language that is widely used for developing operating
systems, embedded systems, and other applications. It is a low-level, compiled language
that provides direct access to hardware resources.
Problem Solving:
Problem solving in C involves identifying a problem, analyzing it, and developing a
solution using C programming language. The steps involved in problem solving are:
1. Problem Analysis: Identify the problem, understand the requirements, and define the
problem clearly.
2. Algorithm Development: Develop an algorithm to solve the problem, which is a step-by-
step procedure for solving the problem.
3. Flowchart and Pseudocode: Create a flowchart and pseudocode to visualize the
algorithm and represent it in a human-readable format.
4. Coding: Write the C code based on the algorithm, flowchart, and pseudocode.
Problem Analysis Chart:
A problem analysis chart is a tool used to analyze a problem and identify the inputs,
outputs, and processing required to solve it. The chart typically includes the following
components:
1. Problem Statement: A clear statement of the problem.
2. Inputs: The data required to solve the problem.
3. Outputs: The expected results of the problem.
4. Processing: The steps required to solve the problem.
, 3
Developing an Algorithm:
An algorithm is a step-by-step procedure for solving a problem. The characteristics of an
algorithm are:
1. Finiteness: An algorithm must terminate after a finite number of steps.
2. Definiteness: An algorithm must have clear and unambiguous instructions.
3. Input: An algorithm must have input data.
4. Output: An algorithm must produce output.
5. Effectiveness: An algorithm must be effective in solving the problem.
Flowchart and Pseudocode:
A flowchart is a graphical representation of an algorithm, while pseudocode is a human-
readable representation of an algorithm.
1. Flowchart: A flowchart uses symbols and arrows to represent the flow of control and
data.
2. Pseudocode: Pseudocode uses a simplified language to represent the algorithm.
Program Structure:
A C program typically consists of the following components:
1. Preprocessor Directives: Instructions to the preprocessor to include header files and
define macros.
2. Global Variables: Variables that are accessible throughout the program.
3. Functions: Blocks of code that perform specific tasks.
4. Main Function: The entry point of the program.
Compilation & Execution Process:
The compilation and execution process involves the following steps:
1. Preprocessing: The preprocessor reads the source code and includes header files and
expands macros.
2. Compilation: The compiler translates the source code into object code.
3. Linking: The linker links the object code with libraries and produces an executable file.
4. Execution: The executable file is executed by the computer.
, 4
Interactive and Script Mode:
C can be used in interactive mode, where commands are executed immediately, or script
mode, where a script file is executed.
1. Interactive Mode: Commands are executed immediately, and results are displayed.
2. Script Mode: A script file is executed, and results are displayed.
Comments, Indentation, Error Messages:
1. Comments: Comments are used to document the code and are ignored by the compiler.
2. Indentation: Indentation is used to improve the readability of the code.
3. Error Messages: Error messages are displayed when the compiler encounters an error in
the code.
Primitive Data Types:
C supports the following primitive data types:
1. int: Integer data type.
2. char: Character data type.
3. float: Floating-point data type.
4. double: Double-precision floating-point data type.
Constants, Variables, Reserved Words:
1. Constants: Constants are values that do not change during the execution of the program.
2. Variables: Variables are used to store values that can change during the execution of the
program.
3. Reserved Words: Reserved words are keywords that have special meaning in C and
cannot be used as variable names.
Operators:
C supports the following operators:
1. Arithmetic Operators: +, -, *, /, %
2. Relational Operators: ==, !=, <, >, <=, >=
3. Logical Operators: &&, ||, !
4. Bitwise Operators: &, |, ^, ~