0% found this document useful (0 votes)
55 views2 pages

E21 E22 E23 0756 CSE1021 Midterm

This document appears to be a midterm exam for an introductory programming course. It contains 5 questions assessing algorithms, complexity analysis, and Python programming skills. Question 1 asks students to write an algorithm, pseudocode, and flowchart to calculate the sum of cubes of digits in a number. Question 2(a) asks students to analyze two algorithms that calculate the sum of cubes from 1 to n and determine if they are correct. Question 2(b) asks students to analyze the time complexity of a given code. Question 3 asks students to write a Python program to perform basic arithmetic operations on integers and floats. Question 4 asks students to write algorithms to find the square root of a number using built-in methods. Question 5

Uploaded by

GRASH KJT
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)
55 views2 pages

E21 E22 E23 0756 CSE1021 Midterm

This document appears to be a midterm exam for an introductory programming course. It contains 5 questions assessing algorithms, complexity analysis, and Python programming skills. Question 1 asks students to write an algorithm, pseudocode, and flowchart to calculate the sum of cubes of digits in a number. Question 2(a) asks students to analyze two algorithms that calculate the sum of cubes from 1 to n and determine if they are correct. Question 2(b) asks students to analyze the time complexity of a given code. Question 3 asks students to write a Python program to perform basic arithmetic operations on integers and floats. Question 4 asks students to write algorithms to find the square root of a number using built-in methods. Question 5

Uploaded by

GRASH KJT
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/ 2

Reg. No.

:
Name :

Mid-Term Examinations – October 2021


Programme : B.Tech Semester : Fall 2021-22
Course : Introduction to Problem Solving and Code :
CSE1021
Programming
Faculty : Dr. Anju Shukla Slot/ Class No. : A11+A12+A13/0756
Time : 1 ½ hours Max. Marks : 50

Answer all the Questions

Sub.
Q.No. Question Description Marks
Sec.

1 Write an algorithm, pseudo code and draw flow chart to perform sum of cubes of the
digits.
10
For example 123= 13+23+33=36

2 (a) The two algorithms below are both intended to calculate the sum of cubes from 1 to n,
where n is any positive integer.
Algorithm 1 Algorithm 2
i←n i←1
5
sum ← 0 sum ← 0
REPEAT n TIMES { REPEAT n TIMES {
sum← sum+(i * i*i) sum← sum + (i * i*i )
i←i-1} i←i+1}
Verify whether both algorithms calculate correct sum or not.
(b) What is the worst time complexity of the following code:

function(int n)
{
if (n==1)
return;
for (int i=1; i<=n; i++)
{ 5
for (int j=1; j<=n; j++)
{
printf("*");
break;
}
}
}
Show steps.
3 Write a python program to perform addition, subtraction, multiplication, integer
10
division and modulo division on two integer and float.

Page 1 of 2
4 Write individual algorithm to find out the square root of a number by using both in
10
built methods math.sqrt and math.pow.
5 Write a python program to check whether a given number is even or odd. If the
number is even, print number’s square and if number is odd print number’s cube.
10
For example if number is 2, it should be printed 22 i.e. 4, if number is 3 it should be
printed 33 i.e. 27.


Page 2 of 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy