Question
How does machine language differ from programming language? 2. A software programmer was given a task to ask a user for a geometric object
How does machine language differ from programming language?
2. A software programmer was given a task to ask a user for a geometric object and its radius and calculate area of the circle. To perform the calculation, she has to use the formula (area=3.14*radius*radius) and print the result. Analyse the following code and remove the bug:
3. When you're writing long numbers, you can group digits using underscores to make large numbers more readable:
>>> universe _age = 20_000_000_000
Print the above variable on the python shell prompt.
Add 12 billion to it and print the result.
4. A student has to enrol in a unit at your institute, XIT. To be eligible for enrolments, XIT checks for various requirements, such as, did s/he pass pre-requisites with a minimum grade 'P' etc. You may include any other requirement(s) also.
In the example,
a. Where, if anywhere, is there ambiguity and what assumptions have you made about the problem?
b. Write a pseudocode for the given problem.
c. Provide a flowchart for the given problem.
5. Write statements in Python for the following math equations: note statement is y= under square root
1.3x^4 - 1.2 x^3 - 4.6 x + 3.2
Evaluate the above expression at the following values of variable x: x =2, x =-2
6. Test and justify the output of the following expressions:
a. (2 * (10 % 5))
b. 9/3*4+6%2*2/2*3. 7.
Scenario - Algorithms
A text analyst wants to analyse a text file. She wants to find out the total number of questions in the text file. She would also like to know if there are acronyms in the text file and keep a count of them so that she can improve the text file later.
"Computational thinking is a way of thinking about problem solving that grew out of computer science. With computational thinking we learn how to break problems down, to create algorithms to solve them, and to generalize those solutions so we can solve even bigger problems. Often, though, we want to teach a computer to execute those algorithms for us, and that's where coding comes in." [1]
a. Write a detailed algorithm and illustrate the problem design with the help of a flowchart to count the total number of questions and acronyms in the text file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started