Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
74 views

Poriyaan - Problem Solving and Python Programming (2 Marks) PDF - Bin-1

Uploaded by

rahulrahul28223
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Poriyaan - Problem Solving and Python Programming (2 Marks) PDF - Bin-1

Uploaded by

rahulrahul28223
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

GE8151 PROBLEM SOLVING AND PYTHON

https://www.poriyaan.in/ PROGRAMMING https://eee.poriyaan.in/


Problem Solving and Python Programming
UNIT-I

/
in
ALGORITHMIC PROBLEM SOLVING

n.
PART-A

aa
1. What is an algorithm?

riy
Algorithm is a step-by-step procedure/description for solving a task or a
problem. The steps must be ordered, unambiguous and finite in number. Algorithm is
an ordered sequence of finite, well defined unambiguous instructions for completing a

o
task it is an English-like representation of the logic which is used to solve the problem.
.p
2. Write an algorithm to accept two numbers compute the sum and print the
result.
w
w

Algorithm:
Step 1: Start
//w

Step 2: Read the two numbers A, B.


Step 3: Compute the sum, sum = A+B
Step 4: Print the value of sum
Step 5: Stop
s:
tp

3. Write an algorithm to find the minimum number in a given list of numbers.


ht

Algorithm:
Step 1: Start
Step 2: Read the limit of list as ‘n’
Step 3: Read the elements of list A
Step 4: Assign min=A[0]
Step 5: for i=1 to n repeat step 6 and step 7
Step 6: Check if A[i]<min
Step 7: Then assign min=A[i]
Step 8: Print the value of min
Step 9: Stop
4. Distinguish between algorithm and program

Algorithm Program
Algorithm is finite. Program need not be finite.
It is a step-by-step procedure to solve a It is an exact code to solve a problem.

/
problem.

in
It is written using natural language or It is written using a specific programming

n.
algorithmic language. language.

aa
5. List the building blocks of algorithm.

The building blocks of an algorithm are

riy
• Statements
• State

o
• Control flow
➢ Sequence
.p
➢ Selection or Conditional
➢ Repetition or Iteration
w
• Functions
w

6. Define statement. List its types.


w

Each and every line in an algorithm is called statement. A statement is a


//

segment of code that represents a command.


s:

Two types:
tp

➢ Simple Statement
➢ Compound Statement
ht

7. How does flow of control work?

Control flow (or flow of control) is the order in which individual statements,
instructions or function calls of a program are executed or evaluated. A control flow
statement is a statement which execution results in a choice being made as to which
of two or more path to follow.

8. Define control flow statement with an eg.

A Control flow statement is a statement which execution results in a choice being made
as to which of two or more paths to follow.

Example: Algorithm to find biggest of two numbers

Step 1: Start

Step 2: Read the two numbers A, B

Step 3: Check if(A>B) then //selection control flow statement


Step 4: Print A is big

Step 5: Else print B is big

Step 6: Stop

/
9. What is a function?

in
A function is a set of related instructions that are used to perform a specified
task which repeatedly occurs in the main program. Functions usually “take in” data,

n.
process it, and “return” a result.

aa
10. Define a pseudocode?

Pseudo means limitation or false and code refers to the instructions written in any

iy
programming language. It is also called Program Design Language (PDL). It is somewhat
halfway in between English and a Programming Language.

or
11. Give the rules of writing Pseudocode.
.p
➢ Write one statement per line.
➢ Keywords must be capitalized
w
➢ Steps must be understandable
➢ It must be concise
w

➢ Statements must be language independent.


//w

12. Write the pseudocode to calculate the sum and product of two numbers and
display it.
s:

BEGIN
READ TWO NUMBERS num1, num2
tp

COMPUTE sum=num1+num2
COMPUTE product=num1*num2
ht

PRINT the value of sum and product


END

13. Give the difference between flowchart and pseudocode (or) Distinguish between
pseudocode and flowchart.
Flowchart Pseudocode
A flowchart is a diagrammatic Pseudo means imitation or false and
representation of an algorithm. code refers to the instructions written in
any programming language.
It follows a standard format. Unlike a flowchart, it uses a written
format.
It uses different shapes of boxes to It can be written in ordinary English, and
represent the processes involved in the with some keywords.
problem
14. Define a flowchart.
A flowchart is a diagrammatic representation of an algorithm. In which the steps
are represented in the form of different shapes of boxes and logical flow is indicated
by interconnecting arrows. The purpose of drawing the flowchart is to help the
programmer in understanding the logic the program.

/
in
15. List the symbols used in drawing the flowchart?
Symbols Name

n.
aa
Terminal

iy
Input/Output

or
Processing
.p
w
Decision
w
//w

Connector
s:

16. List the categories of Programming Languages. (or) Point out any 5-
tp

programming language.

Programming Language are divided into the following categories:


ht

➢ Interpreted Programming Languages


➢ Functional Programming Languages
➢ Compiled Programming Languages
➢ Procedural Programming Languages
➢ Scripting Programming Languages
➢ Markup Programming Languages
➢ Logic-Based Programming Languages
➢ Concurrent Programming Languages
➢ Object-Oriented Programming Languages

17. Compare machine language, assembly language and high-level language.

Machine Language Assembly Language High-Level Language


The language of 0s and 1s It is low level programming High level languages are
is called as machine language in which the English like statements
language. sequence of 0s and 1s are and programs.
replaced by mnemonic (ni-
monic) codes.
The machine language is Typical instruction for Written
w.poriyaan.in/ in these
system independent addition and subtraction languages are needed to
because there are are add and sub. be translated into

/
different set of binary machine language before

in
instruction for different to their execution using a
types of computer system software compiler.

n.
systems.

aa
18. List out the simple strategies to develop an algorithm (or) Discover the steps of
simple strategies for developing algorithms.

iy
Algorithm development process consists of five major steps.

or
Step 1: Obtain a description of the problem
Step 2: Analyze the problem
.p
Step 3: Develop a high-level algorithm
Step 4: Refine the algorithm by adding more details
w
Step 5: Review the algorithm
w

19. Give the difference between recursion and iteration


//w

Recursion Iteration/Repetition
Function calls itself again and Executing the processes until the
s:

again until the base condition is condition fails.


reached.
tp

In recursive function only base Iterative approach involves four


condition (terminate condition) is steps: initialization, condition,
ht

specified. execution and updation.


Recursion keeps your code short Iterative approach makes your code
and simple. longer.
Recursion is slower than iteration
due to overhead of maintaining Iterative is faster.
stack.
Recursion takes more memory. Iteration takes less memory.
Problem Solving and Python Programming (GE3151) – Reg 2021
Unit I: Computational Thinking and Problem Solving
Computational Thinking and Problem Solving | Fundamentals of Computing | Identification of Computational Problems |
Algorithms | Building Blocks | Notation | Algorithmic Problem Solving | Simple Strategies for Developing Algorithms |
Illustrative Problems | Anna University Two Marks Questions & Answers | Multiple Choice Questions and Answers

Unit II: Data Types, Expressions, Statements


Data Types, Expressions, Statements | Introduction to Python | How to Write and Execute Python Program | Concept
of Interpreter and Compiler | Python Interpreter | Interactive and Script Modes | Debugging | Values and Types |
Variables, Expressions and Statements | Tuple Assignment | Indentation, String Operations | Functions | Illustrative
Programs | Anna University Two Marks Questions & Answers | Multiple Choice Questions

Unit III: Control Flow, Functions, Strings


Control Flow, Functions, Strings | Boolean Values | Operators | Input and Output | Conditional Statements | Iteration
| Fruitful Functions | Recursion | Strings | Lists as arrays | Illustrative Programs | Anna University Two Marks
Questions & Answers | Multiple Choice Questions

Unit IV: Lists, Tuples, Dictionaries


Lists, Tuples, Dictionaries | Lists | Tuples | Dictionaries | Advanced List Processing - List Comprehension | Illustrative
Programs | Anna University Two Marks Questions & Answers | Multiple Choice Questions

Unit V: Files, Modules, Packages


Files, Modules, Packages | Files | Command Line Arguments | Errors and Exceptions | Modules | Packages | Two Marks
Questions with Answers | Multiple Choice Questions

Common to all 1st Semester

HOME | EEE | ECE | MECH | CIVIL | CSE


1st Semester Anna University EEE- Reg 2021
Professional English – I
2nd Semester 3rd Semester
Matrices and Calculus
Probability and Complex
Professional English - II Functions
Engineering Physics
Statistics and Numerical Electromagnetic Fields
Engineering Chemistry Methods
Problem Solving and Physics for Electrical Digital Logic Circuits
Python Programming Engineering
Electron Devices and
Physics and Chemistry Basic Civil and Mechanical Circuits
Laboratory Engineering
Electrical Machines - I
Engineering Graphics
C Programming and Data
4th Semester Electric Circuit Analysis Structures
Environmental Sciences
and Sustainability 6th Semester
Transmission and 5th Semester
Distribution Protection and
Linear Integrated Power System Analysis Switchgear
Circuits
Power Electronics Power System
Measurements and Operation and Control
Instrumentation Control Systems
Open Elective – I
Microprocessor and
Microcontroller Professional Elective I
Professional Elective IV
Electrical Machines - II Professional Elective II
Professional Elective V
Professional Elective III
7th Semester Professional Elective VI
High Voltage Mandatory Course-I& Mandatory Course-
Engineering II& MC
Human Values and 8th Semester
Ethics
Elective –
Management Project Work /
Internship
Open Elective – II
Open Elective – III
Open Elective – IV
Professional Elective
VII Click on Clouds to navigate other department

https://www.poriyaan.in/

You might also like