0% found this document useful (0 votes)
163 views6 pages

Sem 1011

This document outlines a course on problem solving and programming. The course objectives are to introduce logical thinking skills for problem solving and programming skills to solve problems using computers. Students will learn to identify problem solving approaches, write pseudocode, translate pseudocode to an executable program, and validate programs. The course includes 15 lab assignments covering topics like calculating acceleration from force and mass, finding numbers divisible by 7 between two ranges, and checking HTML tags. It aims to develop competency in problem solving strategies, data representation, programming structures, and translating problems to code.

Uploaded by

shubham goswami
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)
163 views6 pages

Sem 1011

This document outlines a course on problem solving and programming. The course objectives are to introduce logical thinking skills for problem solving and programming skills to solve problems using computers. Students will learn to identify problem solving approaches, write pseudocode, translate pseudocode to an executable program, and validate programs. The course includes 15 lab assignments covering topics like calculating acceleration from force and mass, finding numbers divisible by 7 between two ranges, and checking HTML tags. It aims to develop competency in problem solving strategies, data representation, programming structures, and translating problems to code.

Uploaded by

shubham goswami
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
You are on page 1/ 6

Code : CSE1001 Problem Solving and Programming

Pre-Req Nil 0-0-6-0-3

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.

3 Write a function called “calc_weight_ on_ planet()” which calculates your 6


equivalent weight on another planet .It should take two arguments: your
weight on Earth and the surface gravity of the planet .

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

Note:. atomic weight of gold (Au) 196.97 with units in grams/mole.


Atomic weight of carbon=12.001
Atomic weight of hydrogen=1.008
Avogadro’s number is a constant, 6.022 × 1023
5 Write a recursive function and an iterative function to compute the Fibonacci 6
sequence. Compare the performance of recursive and iterative function
6 Write a program that prompts the user to enter a list of words and stores in a 6
list only those words whose first letter occurs again within the word (for
example, 'Baboon'). The program should display the resulting list.

7 Write a version of a palindrome recognizer that also accepts phrase 6


palindromes such as "Go hang a salami I'm a lasagna hog.", "Was it a rat I
saw?", "Step on no pets", "Sit on a potato pan, Otis", "Lisa Bonet ate no
basil", "Satan, oscillate my metallic sonatas", "I roamed under it as a tired
nude Maori", "Rise to vote sir", or the exclamation "Dammit, I'm mad!". Note
that punctuation, capitalization, and spacing are usually ignored.
8 In English, the present continuous is formed by adding the suffix -ing to the 6
verb

go -> going. A simple set of heuristic rules can be given as follows:

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

Write a function make_ing_form() which given a verb converts to present


Continuous form. Test your function with words such as lie, see, move and
hug.

9 Define a procedure histogram() that takes a list of integers and prints a 4


histogram to the screen. For example, histogram([4, 9, 7]) should print the
following:

****
*********
*******

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.

11 Write a program to solve a classic ancient Chinese puzzle: We count 35 heads 2


and 94 legs among the chickens and rabbits in a farm. How many rabbits and
how many chickens do we have?
12 A website requires the users to input username and password to register. 6
Write a program to check the validity of password input by users.

Following are the criteria for checking the password:

1. At least 1 letter between [a-z]

2. At least 1 number between [0-9]

3. At least 1 character from [$#@]

4. Minimum length of transaction password: 6

5. Maximum length of transaction password: 12

6. At least 1 letter between [A-Z]

Your program should accept a sequence of comma separated passwords and


will check them according to the above criteria. Passwords that match the
criteria are to be printed, each separated by a comma.

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:

1: Sort based on name


2: Then sort based on age;
3: Then sort by score.
16 In the word game Mad Libs, people are asked to provide a part of speech, such 6
as a noun, verb, adverb, or adjective. The supplied words are used to fill in the
blanks of a preexisting template or replace the same parts of speech in a
preexisting sentence. Although we don’t yet have the tools to implement a full
Mad Libs game, we can implement code that demonstrates how the game
works for a single sentence. Consider this sentence from P. G. Wodehouse:
Jeeves lugged my purple socks out of the drawer as if he were a vegetarian
fishing a caterpillar out of his salad.
Write a program that will do the following:
• Print the following template:
Jeeves [verb] my [adjective] [noun] out of the [noun]
as if he were a vegetarian fishing a [noun] out of his
salad.
• Prompt the user for a verb, an adjective, and three nouns.
• Print the template with the terms in brackets replaced with the words the user
provided.

17 In cryptography, a Caesar Cipher is a very simple encryption techniques in 6


which each letter in the plain text is replaced by a letter some fixed number of
positions down the alphabet. For example, with a shift of 3, A would be
replaced by D, B would become E, and so on.. ROT-13 ("rotate by 13 places")
is a widely used example of a Caesar cipher where the shift is 13.

Write a program to implement an encoder/decoder of ROT-13. Once you're


done, you will be able to read the following secret message:

Pnrfne pvcure? V zhpu cersre Pnrfne fnynq!

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>

Total Lab Hours 90


Course Description

The course will ensure the competency in the following.


An overview :

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

Problem solving strategies:

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

Introduction to program structure:

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 to code approach:

Problem statement, problem analysis, program design, program code, program test

Sorting (Numbers and Strings) :

Bubble sort, Insertion sort, Selection Sort

Searching (Numbers and Strings):

Binary search, Random search, Search for Max-Min

You might also like