0% found this document useful (0 votes)
6 views3 pages

PPS Assignment 1 With Answers

The document outlines an assignment for a Programming for Problem Solving course, covering key concepts such as hardware and software definitions, flowchart symbols, C program structure, C tokens, and functions like printf() and scanf(). It also discusses operator precedence, decision-making statements, looping statements, and jump statements in C, along with examples and explanations for each topic. The assignment includes practical programming tasks such as determining if a number is even or odd and printing the first 10 natural numbers.

Uploaded by

msbook
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)
6 views3 pages

PPS Assignment 1 With Answers

The document outlines an assignment for a Programming for Problem Solving course, covering key concepts such as hardware and software definitions, flowchart symbols, C program structure, C tokens, and functions like printf() and scanf(). It also discusses operator precedence, decision-making statements, looping statements, and jump statements in C, along with examples and explanations for each topic. The assignment includes practical programming tasks such as determining if a number is even or odd and printing the first 10 natural numbers.

Uploaded by

msbook
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

ASSIGNMENT – 1 (FEB 2026)

Subject: Programming for Problem Solving (PPS)


BE 1st Year – II Semester

Q1) What do you mean by hardware and software? Discuss how


software is broadly classified.

Hardware: Hardware refers to the physical components of a computer system which can be seen
and touched. Examples include keyboard, mouse, CPU, monitor, printer, and hard disk.

Software: Software is a collection of programs and instructions that tells the computer hardware
how to perform tasks. Examples include Windows, Linux, MS Word, and C programs.

Classification of Software:
1. System Software: Controls and manages computer hardware and provides a platform for
application software. Examples: Operating System, Compiler, Device Drivers.
2. Application Software: Designed to perform specific user tasks. Examples: MS Word, Excel,
Web Browser, Billing Software.

Q2) Draw and explain different symbols of flowchart and its uses.

A flowchart is a graphical representation of an algorithm showing the sequence of steps using


symbols.

Flowchart Symbols:
• Oval – Used to represent Start and End of a program.
• Rectangle – Used for processing or calculations.
• Parallelogram – Used for input and output operations.
• Diamond – Used for decision making (Yes/No).
• Flow lines – Used to show direction of flow.

Uses of Flowchart:
• Easy understanding of logic
• Helps in debugging
• Better documentation
• Improves program planning

Q3) Discuss the structure of C program.

The structure of a C program consists of the following sections:


1. Documentation Section
2. Link Section (#include)
3. Definition Section (#define)
4. Global Declaration Section
5. main() Function
6. User-defined Functions

This structure helps in organized and readable programming.

Q4) List and explain C Tokens.


C Tokens are the smallest individual units of a C program.

Types of C Tokens:
1. Keywords – Reserved words such as int, float, if, else.
2. Identifiers – Names of variables and functions.
3. Constants – Fixed values like 10, 3.14.
4. Operators – Symbols used for operations like +, -, *, /.
5. Special Symbols – Symbols like {}, (), ;, [].

Q5) Explain printf() and scanf() functions using examples.

printf(): Used to display output on the screen.


scanf(): Used to read input from the user.

Example:
int a;
printf("Enter a number");
scanf("%d",&a;);
printf("Number is %d", a);

Q6) What do you mean by Operator Precedence and


Associativity?

Operator Precedence: Determines the order in which operators are evaluated in an expression.
Associativity: Determines the direction of evaluation (left to right or right to left).

Example: 10 + 5 * 2 = 20 (Multiplication has higher precedence).

Q7) Decision making and branching statements in C.

Decision making statements control the flow of execution based on conditions.

Types include:
• if statement
• if-else statement
• else-if ladder
• nested if
• conditional operator (?:)
• switch-case statement

Q8) Write a C program to find whether a number is even or odd.

The program uses modulus operator (%) to check divisibility by 2. If remainder is 0, number is even;
otherwise odd.

Q9) List and explain looping statements in C.

Looping statements are used to execute a block of code repeatedly.

Types of loops:
• while loop
• do-while loop
• for loop
• nested for loop

Q10) Write a C program to print first 10 natural numbers.

This program uses a for loop to print numbers from 1 to 10 sequentially.

Q11) List and explain jump statements in C.

Jump statements transfer control from one part of program to another.

Types of jump statements:


• break – Terminates loop or switch.
• continue – Skips current iteration.
• goto – Transfers control to labeled statement.

You might also like