0% found this document useful (0 votes)
27 views

Pps CT 1 Set 1

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)
27 views

Pps CT 1 Set 1

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/ 8

COLLEGE OF ENGINEERING AND TECHNOLOGY, SRMIST

DEPARTMENT OF COMPUTING TECHNOLOGY

CYCLE TEST – I
Academic Year: 2022-2023 (ODD Semester)

Program offered: B.Tech (All Branches) Year / Sem: I / I


Max. Marks: 25 Duration: 50 minutes

Course Code and Title: 21CSS101J: Programming for Problem Solving


ANSWER KEY

Course Learning Rationale (CLR):


CLR-1: Think and evolve with a logic to construct an algorithm and pseudocode that can be
converted into a program.
Course Learning Outcomes (CLO):
CLO-1: To solve problems through computer programming. Express the basic data types and
variables in C

Part A (10* 1 = 10 Marks)

Sl.No Question CO PO BL Marks PI


CODE
1 1 1 1 1 2.5.2
---------------- means the set of instructions that make up the
solution after they have been coded into a programming
language.
A. Solution
B. Result
C. Program
D. Error
Answer: C
2 1 2 1 1 2.5.2
Identify the one of the following is true for variable name
in C?

A. Variable names cannot start with a digit

B. Variable can be of any length

C. They can contain alphanumeric characters as well


as special characters.
D. Reserved word can be used as a variable name
Answer: A
3 The operator is true only when both the 1 2 1 1 2.5.2
operands are true.
a) &&
b) ||
c) !
d) ?:
Answer: A
4 Find the output of the following code snippet. 1 2 1 1 1.6.1

void main()

float a=654.1239;

printf("%0.3f",a);

A. Compiler error
B. 654.123900
C. 654.123
D. 654.124
Answer: D
5 1 2 1 1 2.5.2
The Operator '&' is used as
A. Logical AND

B. Bitwise AND

C. Logical OR

D. Bitwise OR
Answer: B
6 1 2 1 1 1.6.1
Find the output of the following code snippet.
A.10
B.11
C. Compile time error
D.0
Answer: C
7. 1 2 1 1 1.61
Find the value of x in this C code

A. 3.75
B. Depends on compiler
C. 24
D. 3
Answer: C
8. Find the output of the following code snippet 1 2 1 1 2.5.2

int a=10;
printf("%x ",a);
printf("%d",a<<2);
A. 10 40
B. a 40
C. 10 46
D. a 46

Answer: B
9. Identify the correct order of evaluation for the 1 2 1 1 2.5.2

expression D = 50 + 12 * 4 / 32 % 4 - 10
a. * / % + - =
b. = * / % + -
c. / * % - + =
d. % / - + =*

Answer. A
10. 1 2 1 1 1.61
Find the output of the following code

#include<stdio.h>
int main ()
{
static int i=5;
if (--i)
{
printf("%d ",i);
main();
}
return (0);
}

A. 54321
B. 0000
C. 4321
D. 00000

Answer. C

Part B (5* 2 = 10 Marks) Answer all questions


Sl.No Question CO PO BL Marks PI
Code
11 Give an overview of the basic structure of a C program. 1 2 2 2 2.6.3

12 Write a note on Algorithm, Flow chart and Pseudocode. 1 2 2 2 2.6.3


 Algorithm is a step-by-step solution in solving a
problem.

 A Flow chart diagram defines the inputs and how


each input will be manipulated all throughout the
program to give an output.

 A Pseudocode is a low-level language that


represents a problem solution using a combination
of English & Math operators to define each step in
the above algorithm.

13 How do you solve some arithmetic expressions based on 1 2 2 2 2.6.3


precedence and associativity?
 Precedence is the priority for grouping different
types of operators with their operands.
Associativity is the left-to-right or right-to-left
order for grouping operands to operators that have
the same precedence.
 So, let's say we have an expression with us which
is 6 * 3 / 20. The evaluation of this expression
would be (6 * 3) / 20 because the associativity
will be left to right for both the operators –
multiplication and division.
14 Differentiate between the static and extern storage class in 1 2 2 2 2.6.3
the C language.

 Static local variable is a local variable that retains


and stores its value between function calls or block
and remains visible only to the function or block in
which it is defined.
 Static global variables are global variables
visible only to the file in which it is declared.
 Extern stands for external storage class. Extern
storage class is used when we have global functions
or variables which are shared between two or more
files.

15 John is playing with a rectangular box (cuboid). He knows 1 2 2 2 2.6.3


the length, width and height of the box. Help him to find the
surface area of the box using a C program.
Hint: Surface area of a cuboid is 2lw + 2lh + 2wh

#include<stdio.h>

int main()

float l,b,h,s,v;

printf("\n Enter length of cuboid :");

scanf("%f",&l);

printf("\n Enter breadth of cuboid :");

scanf("%f",&b);

printf("\n Enter height of cuboid :");

scanf("%f",&h);

s=2*(l*b+b*h+b*h);

v=l*b*h;
printf("\n The surface area of cuboid is '%f'",s);

printf("\n \n The volumer of cuboid is '%f' \n


\n",v);

return 0;

Part C (1 * 5 = 5 Marks)

Sl.No Question CO PO BL Marks PI


Code
16 Write an algorithm, C program and draw flowchart to 1 2 3 5 2.6.3
convert temperature given in Celsius to Fahrenheit.
F=C * 9/5 + 32
 Algorithm 1mark
 Flow chart 1mark
 Program 3 Marks

#include <stdio.h>

int main ()

float celsius, fahrenheit;

printf("Please Enter temperature in Celsius: \n");

scanf("%f", &celsius);

// Convert the temperature

fahrenheit = ((celsius * 9)/5) + 32;

// fahrenheit = ((9/5) * celsius) + 32;

// fahrenheit = ((1.8 * celsius) + 32;

printf("\n %.2f Celsius = %.2f Fahrenheit", celsius,


fahrenheit);

return 0;

}
(OR)
17 Draw flowchart to compute the salary of an employee in 1 2 3 5 2.6.3
a company and write an algorithm for generating the pay
slip of an employee working in XYZ Company. Input for
the process will be the basic pay for the employee.
Gross salary is calculated as Basic Pay + HRA + DA.
HRA is fixed as 30% of basic pay and DA as 80% of
basic pay. Calculate the gross salary

 Algorithm 1mark
 Flow chart 1mark
 Program 3 Marks

1. #include < stdio.h >


2.
3. int main ()
4. {
5. float bs, hra, da, gs;
6.
7. printf("Enter basic salary\n");
8. scanf("%f", &bs);
9.
10. hra = bs * (30/100.00);
11. da = bs * (80/100.00);
12.
13. gs = bs + hra + da;
14.
15. printf("Gross Salary = %f\n", gs);
16.
17. return 0;
18. }

Course Outcome (CO) and Bloom’s level (BL) Coverage in Questions


CO Coverage % BL Coverage %
120 70
100 60
50
80
40
60
30
40
20
20 10
0 0
CO 1 CO 2 CO 3 CO 4 CO 5 BL1 BL2 BL3 BL4 BL5

You might also like