PPS Module Wise Questions
PPS Module Wise Questions
PPS Module Wise Questions
Module 1:-
1. What is computer? Draw a and discuss it’s components.
A computer is a device that accepts information (in the form of digitalized data) and manipulates it for some
result based on a program, software, or sequence of instructions on how the data is to be processed.
Input – Input unit connects the user to the computer by taking data from user and converting it to
machine readable form and transmit this data to the main memory of the computer.
CPU - Central Processing Unit or the CPU, is the brain of the computer. The CPU comprises of two units,
namely – ALU (Arithmetic Logic Unit) and CU (Control Unit).
ALU - The Arithmetic Logic Unit is made of two terms, arithmetic and logic. There are two primary functions
that this unit performs.
1. Data is inserted through the input unit into the primary memory. Performs the basic
arithmetical operation on it. Like addition, subtraction, multiplication, and division. It performs
all sorts of calculations required on the data. Then sends back data to the storage.
2. The unit is also responsible for performing logical operations like AND, OR, Equal to, Less
than, etc. In addition to this it conducts merging, sorting, and selection of the given data.
CU- The control unit as the name suggests is the controller of all the activities/tasks and operations. All this
is performed inside the computer.
Primary memory – Also called temporary memory. It is only used to store recent data. The data
stored in this is temporary. It can get erased once the power is switched off. RAM is an example of
primary memory.
Secondary memory - Also called permanent memory. The hard disk is an example of secondary
memory. Even in a power failure data does not get erased easily.
Output unit- The output unit accepts the data in binary form from the computer. It then converts it
into a readable form for the user.
2. What is algorithm? Discuss it’s characteristics and write an algorithm to find out the
largest number among three given numbers.
The word Algorithm means ” A set of finite rules or instructions to be followed in calculations or
other problem-solving operations ”
The algorithm should be unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. it should
be well-defined inputs. It may or may not take input. The algorithm must clearly define what output will be yielded and it should be
well-defined as well. The algorithm must be finite, i.e. it should
terminate after a finite time. The algorithm must be simple, generic,
and practical. The Algorithm designed must be language-
independent, i.e. it must be just plain instructions that can be
implemented in any language.
1. Start
4. End
3. What is flowchart? Discuss the different types of geometrical figures used in flowchart.
Draw a flowchart to find out the root of quadratic equation.
OR
Print the Fibonacci series.
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be
defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a
task.
This box is of an the main This is a Diamond-shaped This arrow line This circular figure
oval shape which processing codes parallelogram- box-control represents the is used to depict
is used to indicate is written inside shaped box statements like if, flow of the that the flowchart
the start or end of this box. inside which condition like a > algorithm or is in continuation
the program. Every the inputs or 0, etc are written process. It with the further
flowchart diagram outputs are inside this box. represents the steps. This figure
has an oval shape. written. direction of the comes into use
process flow. when the space is
less and the
flowchart is long.
4. Draw a Flowchart to print “Hello” 7 times.
5. Write down about Assembler, Compiler and Operator along with their difference.
A language processor is a computer program that convert source code from programming
language to human readable language. They are of three types :
• Assembler- The Assembler is used to translate the program written in Assembly language
into machine code.
• Compiler- The language processor that reads the complete source program written in high-
level language as a whole in one go and translates it into an equivalent program in machine
language is called a Compiler. Example: C, C++, C#.
• Interpreter- The translation of a single statement of the source program into machine code is
done by a language processor and executes immediately before moving on to the next line is
called an interpreter.
Compiler Interpreter
A compiler is a program that converts the entire source code of An interpreter takes a source program and runs it line by line,
a programming language into executable machine code for a CPU. translating each line as it comes to it.
The compiler takes a large amount of time to analyze the entire source
An interpreter takes less amount of time to analyze the source
code but the overall execution time of the program is comparatively
code but the overall execution time of the program is slower.
faster.
The compiler generates the error message only after scanning the whole Its Debugging is easier as it continues translating the program
program. until the error is met.
For Security purpose compiler is more useful. The interpreter is a little vulnerable in case of security.
Typecasting in C is the process of converting one data type to another data type by the
programmer using the casting operator. There are two types of typecasting in c language:
• Implicit Casting: It performs the conversions without altering any of the values which are
stored in the data variable.
• Explicit Casting: In explicit type casting, we have to force the conversion between data types.
Errors in C programming are discrepancies that can cause a program to malfunction, leading to failures in
compiling, halting execution, or generating incorrect results.
Logical Error- We do not get the output we expected after the compilation and execution of a program, Even
though the code seems error free
Runtime Error- When a program is running, and it is not able to perform any particular operation, it means that
we have encountered a run time error.
System Error - System errors are unexpected or abnormal events that occur during the execution of a program.
Module 2:-
1. What is operator? Discuss different types of operators in c language?
An operator in C can be defined as the symbol that helps us to perform some specific
mathematical, relational, bitwise, conditional, or logical computations on values and variables.
https://www.geeksforgeeks.org/operators-in-c/
The concept of operator precedence and associativity in C helps in determining which operators will be
given priority when there are multiple operators in the expression.
Operator
Precedence Description Associativity
. Dot Operator
Operator
Precedence Description Associativity
* Dereference Operator
6 Left-to-Right
12 || Logical OR Left-to-Right
= Assignment
14 Right-to-Left
Module 3:-
1. What is control statements? Discuss the different types of Control statements?
Control statements in C are programming constructs that are used to control the flow of execution in a
program. These are of three types: Selection statements, Iteration statements, Switch statements.
Selection Statements Iteration statements Switch Statements
if (num > 0) { int i = 0; switch (num) {
} } case 10:
break;
default:
break;
2. What is looping? Discuss the different types of loops in c language? write it’s syntax.
Looping- Loops in programming are used to repeat a block of code until the specified condition is met.
Two types of loops : Entry controlled loops – For loop, While loop | Exit controlled loops- Do-while
loop.
first Initializes, then condition check, then executes the body and at last, the
for loop
update is done.
first Initializes, then condition checks, and then executes the body, and
while loop
updating can be inside the body.
do-while
do-while first executes the body and then the condition check is done.
loop
Initialization expression;
update expression;
Initialization expression;
do
Update expression;
3. What is conditional control statements? Discuss the different types of conditional control
statements. Write the syntax of each.
The conditional statements (also known as decision control structures) such as if, if else, switch, etc. are used
for decision-making purposes in C programs.
https://www.geeksforgeeks.org/decision-making-c-cpp/
Module 4:-
1. What is datatype? Discuss the different types of datatypes in C language.
The data type is a collection of data with values having fixed values, meaning as well as its
characteristics. The data types in C can be classified as follows:
Types Description
I. strcat() Function: Used for concatenation. Append a copy of source string to the end of destination string.
Syntax- [char* strcat(char* dest, const char* src);]
• The strcat() function returns a pointer to the dest string.
II. Strlen() Function: Calculates the length of a given string.
Syntax- [int strlen(const char *str);]
III. Strcmp() Function: This function takes two strings as arguments and compares these two strings lexicographically.
Syntax- [int strcmp(const char *str1, const char *str2);]
• If str1 is less than str2, the return value is less than 0.
• If str1 is greater than str2, the return value is greater than 0.
• If str1 is equal to str2, the return value is 0.
IV. Strcpy() Function: Use to copy one string in another.
Syntax- [char* strcpy(char* dest, const char* src);]
V. Strstr() Function: Used to search the first occurrence of a substring in another string.
Syntax- [char *strstr(const char *s1, const char *s2);]
• If the s2 is found in s1, this function returns a pointer to the first character of the s2 in s1, otherwise, it returns a
null pointer.
• It returns s1 if s2 points to an empty string.
https://www.geeksforgeeks.org/string-functions-in-c/?ref=lbp
Module 5:-
1. What is function? Discuss the different types of functions in C language.
A function in C is a set of statements that when called perform some specific task. It is the basic building block
of a C program that provides modularity and code reusability.
Two types of functions:
a)Library Functions - A library function is also referred to as a “built-in function”. A compiler package already exists that
contains these functions, each of which has a specific meaning and is included in the package. Example- pow(), strlen(),
sqrt(), printf(),scanf(),etc…
b)User-defined Functions- Functions that the programmer creates are known as User-Defined functions or “tailor-made
functions”. Whenever we write a function that is case-specific and is not defined in any header file, we need to declare and
define our own functions according to the syntax.
2. What is function prototype? Discuss the function prototype and function definition.
The C function prototype is a statement that tells the compiler about the function’s name, its return type,
numbers and data types of its parameters.
Syntax
return_type function_name(parameter_list);
A function prototype is a
A function declaration is valid even function declaration that
with only function name and return provides the function’s name,
type. return type, and parameter list
without including the function
body.
Syntax:
Syntax:
return_type
return_type function_name();
function_name(parameter_list);
3. What is function parameter? Discuss the different types of methods to pass the parameter?
Argument Parameter
When a function is called, the values that are passed The values which are defined at the time of the function prototype or
during the call are called as arguments. definition of the function are called as parameters.
These are used in function call statement to send value These are used in function header of the called function to receive the value
from the calling function to the receiving function. from the arguments.
During the time of call each argument is always assigned Parameters are local variables which are assigned value of the arguments
to the parameter in the function definition. when the function is called.
They are also called Actual Parameters They are also called Formal Parameters
Example:
Example:
int Call(int rnum)
int num = 20; {
Call(num) printf("the num is %d", rnum);
}
// num is argument
// rnum is parameter
4. What is the difference between call by value and call by reference in functions in C?
Call By Value Call By Reference
With this method, the changes made to the dummy variables in the With this method, using addresses we would have access to
called function have no effect on the values of actual variables in the the actual variables and hence we would be able to
calling function. manipulate them.
In call-by-values, we cannot alter the values of actual variables In call by reference, we can alter the values of variables
through function calls. through function calls.
// Function Prototype
// Function Prototype
void swapx(int*, int*);
void swapx(int x, int y);
// Main function
// Main function
int main()
int main()
{
{
int a = 10, b = 20;
int a = 10, b = 20;
// Pass reference
// Pass by Values
swapx(&a, &b); // Actual Parameters
swapx(a, b); // Actual Parameters
return 0;
return 0;
}
}
t = *x;
t = x;
*x = *y;
x = y;
*y = t;
y = t;
Types of Recursion:
1. Direct recursion: When a function is called within itself directly it is called direct recursion. This can be further
categorised into four types:
• Tail recursion,
• Head recursion,
• Tree recursion and
• Nested recursion.
2. Indirect recursion: Indirect recursion occurs when a function calls another function that eventually calls the
original function and it forms a cycle.
Module 6:-
1. What is pointer?
A pointer is defined as a derived data type that can store the address of other C variables or a memory
location. We can access and manipulate the data stored in that memory location using pointers.
int main()
{
int var = 789;
return 0;
}
Module 7:-
1. What is Structure? Write down the difference between structure and union.
The structure in C is a user-defined data type that can be used to group items of possibly different types into
a single type. The struct keyword is used to define the structure in the C programming language.