PART A (2 Marks)
UNIT I
1. Define problem-solving in programming.
Problem-solving in programming is the process of analyzing a problem,
breaking it into smaller steps, and designing a solution that can be
implemented using a program.
2. What is the purpose of a loop?
The purpose of a loop is to execute a set of statements repeatedly until
a given condition is satisfied, which reduces code repetition and saves
time.
3. Differentiate between high-level and low-level languages.
High-Level Language Low-Level Language
Easy to understand Difficult to understand
User-friendly Machine-oriented
4. Give two examples of compiled languages.
Two examples of compiled languages are:
C
C++
5. Why are comments used?
Comments are used to explain the program logic and make the code
easier to understand. They are ignored by the compiler.
6. What is the difference between if and else-if?
if checks the first condition.
else-if checks additional conditions if the previous if condition is
false.
7. What is meant by input/output error?
An input/output error occurs when there is a problem while reading
input or displaying output, such as invalid input data or device failure.
8. What happens if indentation is not used properly?
Improper indentation can make the code confusing and difficult to
read, and in some languages like Python, it can cause syntax errors.
9. What is a conditional statement?
A conditional statement is used to make decisions in a program by
executing different blocks of code based on conditions (example: if,
else).
10. Define sequential execution.
Sequential execution means that program statements are executed one
after another in order, from top to bottom, without skipping any
statement.
UNIT II
1. Define a flowchart.
A flowchart is a graphical representation of an algorithm using symbols
to show the flow of control step by step.
2. Name any two flowchart symbols.
Two flowchart symbols are:
Oval (Start/Stop)
Rectangle (Process)
3. What is a connector in flowcharts?
A connector is used to connect different parts of a flowchart, especially
when the flowchart is too large to fit on one page.
4. Write one advantage of flowcharting.
One advantage of flowcharting is that it makes the program logic easy
to understand and visualize.
5. Define algorithm.
An algorithm is a finite set of clear and ordered steps used to solve a
specific problem.
6. What is meant by flow of control?
Flow of control refers to the order in which statements are executed in
a program, including sequence, selection, and looping.
7. What is terminal symbol?
The terminal symbol is an oval-shaped symbol used in flowcharts to
represent the start and end of a program.
8. Write one use of flowcharts in debugging.
Flowcharts help in debugging by visually identifying logical errors in the
program flow.
9. Explain why flowcharts help in avoiding logical errors.
Flowcharts show each step clearly, making it easy to detect missing
steps or wrong logic, thus reducing logical errors.
10. Write one difference between pseudocode and flowchart.
Pseudocode is written in plain text.
Flowchart is represented using graphical symbols.
UNIT III
1. Define pseudocode.
Pseudocode is an informal, human-readable description of program
logic written using simple English and programming-like statements.
2. What is an algorithm?
An algorithm is a finite, step-by-step procedure used to solve a specific
problem in a logical manner.
3. Write any two advantages of pseudocode.
It is easy to understand and write.
It helps in planning program logic before actual coding.
4. What is top-down design?
Top-down design is a programming approach where a problem is
divided into smaller sub-problems, making it easier to design and
implement.
5. What is meant by complexity analysis?
Complexity analysis is the process of evaluating an algorithm’s time
and memory usage to measure its performance.
6. What is the purpose of loops in pseudocode?
Loops in pseudocode are used to repeat a set of instructions until a
specific condition is met.
7. What is meant by algorithm efficiency?
Algorithm efficiency refers to how well an algorithm uses time and
memory resources while solving a problem.
8. What is Big O notation?
Big O notation is used to express the time or space complexity of an
algorithm in terms of input size.
9. What is a conditional control structure?
A conditional control structure allows a program to make decisions and
execute statements based on conditions (example: IF–ELSE).
10. Differentiate between algorithm and pseudocode.
Algorithm Pseudocode
Logical steps to solve a problem Written form of algorithm
No fixed format Uses programming-like format
UNIT IV
1. Define pattern generation.
Pattern generation is the process of printing numbers, symbols, or
characters in a specific design using loops.
2. What is a palindrome?
A palindrome is a number or word that reads the same forward and
backward, such as 121 or MADAM.
3. Define array.
An array is a collection of elements of the same data type stored in
consecutive memory locations.
4. Define leap year.
A leap year is a year that has 366 days and is divisible by 4 (but not by
100 unless also divisible by 400).
5. What is number factoring?
Number factoring is the process of finding the factors of a given
number that divide it exactly.
6. What is an algorithm?
An algorithm is a step-by-step method used to solve a problem logically
and efficiently.
7. Write one use of arrays.
Arrays are used to store and process multiple values using a single
variable name.
8. Write one property of palindromes.
A palindrome remains unchanged when its digits or characters are
reversed.
9. What is Fibonacci series?
The Fibonacci series is a sequence where each number is the sum of
the previous two numbers, starting from 0 and 1.
10. Differentiate between prime test and prime generation.
Prime Test Prime Generation
Checks if a number is prime Finds all prime numbers
Single number Range of numbers
UNIT V
1. Define ethics in software development.
Ethics in software development refers to moral principles and
professional standards followed while developing software.
2. What is plagiarism?
Plagiarism is the act of copying someone else’s work or code without
permission or acknowledgment.
3. Define open-source.
Open-source software is software whose source code is freely available
for use, modification, and distribution.
4. What is a bug?
A bug is an error or defect in a program that causes incorrect or
unexpected output.
5. What is version control?
Version control is a system that tracks changes in source code and helps
manage multiple versions.
6. What is Git?
Git is a distributed version control system used to track code changes
and collaborate with others.
7. Define repository.
A repository is a storage location where project files and their version
history are maintained.
8. What is a commit?
A commit is a saved snapshot of changes made to files in a repository.
9. What is code review?
Code review is the process of examining source code to improve
quality, detect errors, and ensure standards.
10. What is professionalism?
Professionalism refers to responsible behavior, ethical conduct, and
respect shown in the workplace.
PART B (10 Marks)
UNIT I
1. Explain problem-solving steps in programming with an example.
Problem-solving in programming is a systematic approach used to
analyze a problem and develop an effective program. The main steps
are:
1. Problem Definition
Understand what the problem is and identify inputs and outputs clearly.
2. Problem Analysis
Break the problem into smaller parts and decide the required
operations.
3. Algorithm Design
Prepare a step-by-step solution using logical steps.
4. Flowchart / Pseudocode
Represent the algorithm visually or in structured English to check logic.
5. Coding
Convert the algorithm into a program using a programming language.
6. Testing and Debugging
Test the program with sample inputs and correct errors.
7. Documentation and Maintenance
Document the program and update it if required.
Example: Finding the sum of two numbers
Input: Two numbers
Process: Add both numbers
Output: Display the sum
Algorithm:
1. Start
2. Read two numbers
3. Add them
4. Display the sum
5. Stop
Thus, following proper problem-solving steps ensures accurate and
efficient programs.
2. Describe conditional statements with suitable examples.
Conditional statements are used to make decisions in a program based
on conditions. They execute different blocks of code depending on
whether a condition is true or false.
Types of Conditional Statements
1. if statement
Executes code only when the condition is true.
Example:
If marks ≥ 40, print “Pass”.
2. if–else statement
Executes one block if condition is true and another if false.
Example:
If marks ≥ 40 → Pass
Else → Fail
3. else-if ladder
Used to check multiple conditions.
Example:
If marks ≥ 90 → Grade A
Else if marks ≥ 75 → Grade B
Else → Grade C
4. Nested if
An if statement inside another if statement.
Advantages
Helps in decision-making
Improves program logic
Controls program flow
Thus, conditional statements are essential for logical control in
programming.
3. Compare while loop and for loop with examples.
Loops are used to repeat a set of statements until a condition is
satisfied.
while Loop
Condition is checked before execution
Used when number of iterations is unknown
Example:
Print numbers from 1 to 5 using while loop.
for Loop
Initialization, condition, and increment in one line
Used when number of iterations is known
Example:
Print numbers from 1 to 5 using for loop.
Comparison Table
Feature while loop for loop
Usage Unknown iterations Known iterations
Structure Simple condition Compact structure
Control Manual update Automatic update
Both loops are important and used based on requirement.
4. Explain high-level and low-level languages with examples.
Programming languages are classified into high-level and low-level
languages.
High-Level Languages
Easy to understand
English-like syntax
Machine independent
Examples: C, Java, Python
Advantages:
Easy to learn
Faster development
Portable
Low-Level Languages
Close to hardware
Difficult to understand
Machine dependent
Types:
Machine language
Assembly language
Advantages:
Faster execution
Efficient memory usage
Conclusion
High-level languages are user-friendly, while low-level languages
provide better control over hardware.
5. Explain common input/output errors and how to handle them.
Input/Output errors occur during data entry or output display.
Common Input Errors
Entering wrong data type
Missing input
Invalid input range
Common Output Errors
Incorrect formatting
Wrong result display
Device failure
Handling I/O Errors
Use input validation
Display error messages
Use exception handling
Test with different inputs
Proper handling of I/O errors improves program reliability.
UNIT II
1. Explain flowchart symbols with neat diagrams.
A flowchart uses standard symbols to represent program logic.
Common Flowchart Symbols
1. Terminal (Oval)
Represents Start and End
2. Process (Rectangle)
Represents calculations or instructions
3. Input/Output (Parallelogram)
Used for reading or displaying data
4. Decision (Diamond)
Used for condition checking
5. Flow lines (Arrow)
Shows flow direction
6. Connector (Circle)
Connects different parts of flowchart
Flowchart symbols help in clear visualization of logic.
2. Draw and explain a flowchart to find the largest of three numbers.
Steps:
1. Start
2. Read three numbers A, B, C
3. Compare A with B and C
4. If A is largest, print A
5. Else compare B and C
6. Print largest number
7. Stop
Explanation
The flowchart uses decision symbols to compare values and determine
the largest number logically.
3. Develop a flowchart for checking a leap year.
Logic:
If year divisible by 400 → Leap year
Else if divisible by 100 → Not leap year
Else if divisible by 4 → Leap year
Else → Not leap year
Steps:
1. Start
2. Read year
3. Apply conditions
4. Display result
5. Stop
Flowchart helps in visualizing complex conditions clearly.
4. Compare algorithm and flowchart.
Algorithm Flowchart
Step-by-step text solution Graphical representation
Easy to write Easy to understand
No symbols used Uses standard symbols
Both are important tools in program design.
5. Explain peer review process in flowchart improvement.
Peer review is a process where other programmers examine a
flowchart to identify mistakes and suggest improvements.
Steps in Peer Review
1. Review logic flow
2. Check symbol usage
3. Identify missing steps
4. Suggest improvements
5. Correct errors
Benefits
Reduces logical errors
Improves clarity
Enhances quality
Peer review ensures accurate and efficient flowchart design.
UNIT III
1. Write pseudocode for finding factorial of a number.
Factorial
Factorial of a number n is the product of all positive integers from 1 to
n.
Example: 5! = 5 × 4 × 3 × 2 × 1 = 120.
Algorithm Logic
Read a number
Initialize factorial as 1
Multiply numbers from 1 to n
Display result
Pseudocode
START
READ n
fact ← 1
FOR i ← 1 TO n DO
fact ← fact × i
END FOR
PRINT fact
STOP
Explanation
Loop repeats n times
Each iteration multiplies the current value
Final result gives factorial
Conclusion
This pseudocode efficiently calculates factorial using iteration and
looping.
2. Explain top-down design with an example.
Top-Down Design
Top-down design is a problem-solving approach where a complex
problem is divided into smaller and simpler sub-modules.
Steps in Top-Down Design
1. Identify the main problem
2. Divide it into smaller tasks
3. Solve each sub-task independently
4. Combine all modules
Example: Student Result System
Main Problem: Calculate student result
Sub-modules:
Input student marks
Calculate total
Calculate percentage
Assign grade
Display result
Advantages
Easy to understand
Simplifies debugging
Improves modularity
Saves development time
Conclusion
Top-down design helps in structured program development and better
code organization.
3. Explain Big O notation with simple examples.
Big O Notation
Big O notation describes how an algorithm’s execution time or space
grows as input size increases.
Purpose
Measure algorithm efficiency
Compare algorithms
Predict performance
Common Big O Notations
1. O(1) – Constant Time
Example: Accessing an array element
2. O(n) – Linear Time
Example: Loop running n times
3. O(n²) – Quadratic Time
Example: Nested loops
Example
FOR i = 1 TO n
PRINT i
Time Complexity: O(n)
Conclusion
Big O notation helps in choosing efficient algorithms for large inputs.
4. Analyze time complexity of a simple loop.
Time Complexity
Time complexity measures the number of operations performed by an
algorithm.
Example Loop
FOR i = 1 TO n
PRINT i
Analysis
Loop runs n times
Each iteration takes constant time
Total operations proportional to n
Time Complexity
O(n)
Importance
Predicts performance
Helps optimize code
Essential for large data processing
Conclusion
Simple loops usually have linear time complexity.
5. Compare algorithm and pseudocode.
Algorithm Pseudocode
Step-by-step problem solution Written form of algorithm
Uses plain language Uses programming style
Conceptual Closer to actual code
Algorithm Pseudocode
No strict format Semi-structured format
Conclusion
Algorithms define logic, while pseudocode expresses it clearly for
implementation.
UNIT IV
1. Write program to reverse an array.
Logic
Read array elements
Swap elements from start and end
Continue until middle is reached
C Program
#include <stdio.h>
int main() {
int a[50], n, i, temp;
printf("Enter number of elements: ");
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%d", &a[i]);
for(i = 0; i < n/2; i++) {
temp = a[i];
a[i] = a[n-i-1];
a[n-i-1] = temp;
}
printf("Reversed array:\n");
for(i = 0; i < n; i++)
printf("%d ", a[i]);
return 0;
}
Explanation
The program swaps elements to reverse the array efficiently.
2. Explain palindrome detection logic.
Palindrome
A palindrome reads the same forward and backward.
Logic
1. Store original value
2. Reverse the number/string
3. Compare original and reversed values
Example
121 → Reverse = 121 → Palindrome
Applications
Number checking
String validation
Pattern problems
Conclusion
Palindrome detection uses simple comparison logic.
3. Analyze efficiency of array searching.
Types of Searching
Linear Search
Checks elements one by one
Time Complexity: O(n)
Binary Search
Works on sorted arrays
Divides array into halves
Time Complexity: O(log n)
Comparison
Binary search is faster but requires sorted data.
Conclusion
Efficiency depends on data size and structure.
4. Develop a program to check leap year.
Leap Year Rules
Divisible by 400 → Leap year
Divisible by 100 → Not leap year
Divisible by 4 → Leap year
C Program
#include <stdio.h>
int main() {
int year;
scanf("%d", &year);
if(year % 400 == 0)
printf("Leap Year");
else if(year % 100 == 0)
printf("Not a Leap Year");
else if(year % 4 == 0)
printf("Leap Year");
else
printf("Not a Leap Year");
return 0;
}
5. Design algorithm to find prime numbers.
Prime Number
A number divisible only by 1 and itself.
Algorithm
1. Read number n
2. Check divisibility from 2 to n−1
3. If divisible → Not prime
4. Else → Prime
Conclusion
Prime checking helps in cryptography and mathematics.
UNIT V
1. Explain ethical issues in software development.
Ethical Issues
Ethics refers to moral principles followed in professional work.
Common Ethical Issues
Data privacy violation
Software piracy
Security negligence
Biased algorithms
Misuse of user data
Importance
Protects users
Builds trust
Maintains professionalism
2. Discuss importance of intellectual property laws.
Intellectual Property (IP)
Legal rights protecting creative works.
Importance
Prevents unauthorized copying
Encourages innovation
Protects ownership
Ensures fair usage
Examples
Copyrights, patents, trademarks
3. Explain ethical use of open-source software.
Open-Source Ethics
Follow license terms
Give proper credit
Do not misuse code
Share improvements
Benefits
Legal safety
Community growth
Professional integrity
4. Describe best practices for code documentation.
Best Practices
Use meaningful comments
Write clear function descriptions
Update documentation regularly
Use consistent format
Advantages
Easy maintenance
Better understanding
Improves collaboration
5. Explain repository management in Git.
Repository
A storage area for project files and history.
Repository Management Includes
Creating repositories
Committing changes
Using branches
Merging code
Maintaining versions
Benefits
Version tracking
Team collaboration
Code safety
PART C (10 Marks)
1. Analyze a poorly written program and suggest improvements in
logic and formatting.
Introduction
A poorly written program may work correctly but can be hard to
understand, maintain, and debug due to poor logic structure and
formatting.
Common Problems in Poor Programs
No proper indentation
Unclear variable names
No comments
Repeated code
Complex logic in one block
No error handling
Example Issues
Variables like a, b, x1
Deeply nested conditions
Missing input validation
Suggested Improvements
1. Improve Logic
Break large code into smaller functions
Use loops instead of repeated statements
Simplify conditions
Apply top-down design
2. Improve Formatting
Proper indentation
Meaningful variable names
Consistent spacing
Use comments to explain logic
3. Error Handling
Validate inputs
Display meaningful error messages
Benefits of Improvements
Better readability
Easy debugging
Easier maintenance
Improved performance
Conclusion
Good logic and proper formatting make programs professional,
efficient, and easy to understand.
2. Design a program structure using proper conditionals and loops for
a real-life problem.
Introduction
Conditionals and loops help solve real-life problems logically and
efficiently.
Example Problem: Student Result Processing System
Program Structure
Step 1: Input
Read student marks
Step 2: Processing
Calculate total using loop
Calculate percentage
Assign grade using conditional statements
Step 3: Output
Display result
Use of Conditionals
If marks ≥ pass mark → Pass
Else → Fail
Use of Loops
Loop through subjects
Avoid repetition
Advantages
Reduces code size
Improves logic clarity
Handles multiple students easily
Conclusion
Proper use of conditionals and loops ensures correct decision-making
and repetition control in real-life applications.
3. Propose a flowchart for ATM transaction processing.
Introduction
ATM systems require secure and logical transaction processing.
ATM Flowchart Steps
1. Start
2. Insert card
3. Enter PIN
4. Validate PIN
5. Display menu
6. Select transaction
7. Process request
8. Update balance
9. Print receipt
10. Eject card
11. Stop
Decision Points
Correct PIN?
Sufficient balance?
Transaction success?
Advantages of Flowchart
Easy visualization
Error detection
Improved system reliability
Conclusion
A well-designed ATM flowchart ensures secure and efficient banking
transactions.
4. Design a flowchart for an online registration system.
Introduction
Online registration systems manage user data efficiently.
Flowchart Steps
1. Start
2. Enter personal details
3. Validate inputs
4. Check username availability
5. Create account
6. Display confirmation
7. Stop
Decision Points
Valid input?
Username already exists?
Advantages
Reduces errors
Ensures data accuracy
Improves user experience
Conclusion
Flowcharts help design reliable online registration systems with proper
validations.
5. Analyze Big O complexity of a real-life problem.
Introduction
Big O notation measures algorithm performance for large inputs.
Example: Searching a Contact in Phonebook
Linear Search
Checks each contact
Time Complexity: O(n)
Binary Search
Requires sorted contacts
Time Complexity: O(log n)
Analysis
Small data → Linear search acceptable
Large data → Binary search preferred
Conclusion
Big O analysis helps choose the best solution for real-life applications.
6. Evaluate efficiency of two algorithms for same problem.
Problem: Finding Maximum Element
Algorithm 1: Compare All Pairs
Uses nested loops
Time Complexity: O(n²)
Algorithm 2: Single Pass
Uses one loop
Time Complexity: O(n)
Comparison
Feature Algorithm 1 Algorithm 2
Time Slow Fast
Memory Same Same
Conclusion
Algorithm 2 is more efficient and preferred.
7. Evaluate different approaches for prime number generation.
Approach 1: Simple Division Method
Check divisibility
Time Complexity: O(n²)
Approach 2: Optimized Trial Division
Check up to √n
Time Complexity: O(n√n)
Approach 3: Sieve of Eratosthenes
Marks non-prime numbers
Time Complexity: O(n log log n)
Conclusion
Sieve method is best for generating large prime sets.
8. Propose solution for large data array processing.
Challenges
Memory usage
Slow performance
Data overflow
Proposed Solutions
Use efficient algorithms (O(n log n))
Use chunk processing
Avoid nested loops
Use indexing
Apply parallel processing
Benefits
Faster execution
Reduced memory usage
Scalability
Conclusion
Optimized processing ensures efficient handling of large data arrays.
9. Analyze a plagiarism case in software development.
Introduction
Plagiarism is copying code without permission or credit.
Case Analysis
Developer copies open-source code
No license acknowledgment
Claims ownership
Ethical Issues
Violation of IP laws
Loss of trust
Legal consequences
Preventive Measures
Use plagiarism detection tools
Follow licenses
Give proper credit
Conclusion
Avoiding plagiarism maintains ethical and professional integrity.
10. Review a project and suggest ethical improvements.
Project Review Areas
Data handling
Code originality
Security practices
User privacy
Suggested Ethical Improvements
Protect user data
Use licensed software
Write original code
Add transparency
Follow coding standards
Benefits
User trust
Legal compliance
Professional reputation
Conclusion
Ethical improvements enhance project quality and social responsibility.