Sem 1011
Sem 1011
Course Objective
Introduce the essential skills for a logical thinking to
problem solving
Introduce the essential skills in programming for
problem solving using computer
Outcomes
On completion of the course, students will have the
-ability to identify an appropriate approach to solve the problem
-ability to write a pseudo code for the identified strategy
-ability to translate the pseudocode into an executable
program
-ability to validate the program for all the possible inputs.
S.No LAB
Topics
Hrs
1 Newton’s Second Law of motion is expressed in the formula F = m × a where 4
F is force,m is mass, and a is acceleration. Assume that the user knows the
mass of an object and the force on that object but wants to obtain the object’s
acceleration a. Write a program to Calculate the acceleration and display the
result to the user.
2 Write a program which will find all such numbers which are divisible by 7 but 2
are not a multiple of 5, between 2000 and 3200 (both included). The numbers
obtained should be printed in a comma separated sequence on a single line.
Note:
23.1 m/s2 which is the approximate surface gravity of Jupiter and Earth’s
surface gravity is approximately 9.8 m/s2. weight is equal to mass times
surface gravity.
4 Write a function called num_atoms() that calculates how many atoms are in n 6
grams of an element given its atomic weight. This function should take two
parameters: the amount of the element in grams and atomic weight of the
element
1. If the verb ends in e, drop the e and add ing (if not exception: be, see,
flee, knee, etc.)
2. If the verb ends in ie, change ie to y and add ing
3. For words consisting of consonant-vowel-consonant, double the final
letter before adding ing
4. By default just add ing
****
*********
*******
10 A pangram is a sentence that contains all the letters of the English alphabet at 2
least once, for example: The quick brown fox jumps over the lazy dog. write a
function to check a sentence to see if it is a pangram or not.
13 Write a program that maps a list of words into a list of integers representing 4
the lengths of the correponding words. Write it in three different ways: 1)
using a for-loop, 2) using the higher order function map(), and 3) using list
comprehensions
14 Write a program that prompts the user to enter types of fruit, and weight of 6
fruit. The program should then display the information in the form fruit,
weight listed in alphabetical order, one fruit type per line as shown below
Apple, 6 lbs.
Banana, 11 lbs.
etc.
15 Write a program to sort the (name, age, height) tuples by ascending order 6
where name is string, age and height are numbers. The tuples are input by
console. The sort criteria is:
18 Write a program that can check an HTML document for proper opening and 6
closing tags
<html>
<head>
<title>
Example
</title>
</head>
<body>
<h1>Hello, world</h1>
</body>
</html>
Problem solving:
General problem solving concepts, approaches and challenges, problem solving with computers, problem solving tools: flowcharts,
algorithms, data structures, Pseudo code.
Various Approaches :
Solve by analogy, Decompose the task into smaller subtasks, Building block approach, Merging solutions, Algorithmic thinking, Choice of
appropriate data structures, Implementation of the Pseudo-code, implementing the code, Testing the solution
Abstraction, analogy, brainstorming, divide and conquer, reduction, trial and error, heuristics, exhaustive search, backtracking, Greedy
Data representation:
Data processing, data types: primitive and user-defined. arrays: one-dimensional, two-dimensional, multi-dimensional, pointers, stacks,
queues, list, linked list, file structures
Variables and constants, local and global variables, expressions, control structures, selection structures, arithmetic, relational and logical
operators, Conditional and looping statements, programming in manageable pieces: program modules, subprograms, functions, recursion
Problem statement, problem analysis, program design, program code, program test