munotes® Sign in

Engineering Sem 2 C Programming 2022 - Summer R19 Question Paper with Solutions

Mumbai University Solved Question Papers munotes.in

C Programming

Engineering · Sem 2

2022 - Summer R19 Examination

Previous Year Question Paper with Solution

munotes.in Mumbai

munotes.in

First published on munotes.in on 2 December 2026.

Published by munotes.in, Mumbai.

Model answers written and edited by the munotes.in editorial desk.

Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.

munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.

The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.

The question paper reproduced here is the paper as set by the University of Mumbai at the 2022 - Summer R19 examination.

munotes.in ii
munotes.in iii
munotes.in iv
munotes.in v

The Paper as Set

The questions in this volume are the questions asked at the 2022 - Summer R19 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.

Duration 2 hours  ·  Total marks 60  ·  24 questions answered

How to use this volume

Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.

munotes.in vi

Q1

Q1

Choose the correct option for following questions. All the Questions are compulsory and carry equal marks; 2 Marks each · 12 Marks

munotes.in 1

1.What inbuilt function should be used to return a value rounded up to the next higher integer? Option A: floor( ). Option B: round( ). Option C: puts( ). Option D: ceil( ).[2]

Answer

For full marks, cover: what "rounded up" means, the correct option, what each of the other options does, and a short program that compares them on positive and negative values.

Answer: Option D, ceil( ).

Why

ceil( ) is declared in math.h. It returns the smallest whole number that is not less than its argument, as a double. So ceil(4.2) is 5.0, the next higher integer. For a negative value it still moves up, towards zero: ceil(-4.2) is -4.0.

The other options

  1. Option A, floor( ): it rounds down, to the largest whole number not greater than the value. floor(4.7) is 4.0.
munotes.in 2
  1. Option B, round( ): it rounds to the nearest whole number. round(4.7) is 5.0 but round(4.2) is 4.0, so it does not always go up.
  2. Option C, puts( ): it is declared in stdio.h and prints a string followed by a new line. It does no rounding at all.

Program in C

#include <stdio.h>

#include <math.h>

int main(void)

{

double v[3] = {4.2, 4.7, -4.2};

int i;

for (i = 0; i < 3; i++)

printf("x = %.1f, floor = %.1f, round = %.1f, ceil = %.1f\n", v[i], floor(v[i]), round(v[i]), ceil(v[i]));

puts("puts( ) only prints a string and a new line");

return 0;

}

Output

munotes.in 3

x = 4.2, floor = 4.0, round = 4.0, ceil = 5.0

x = 4.7, floor = 4.0, round = 5.0, ceil = 5.0

x = -4.2, floor = -5.0, round = -4.0, ceil = -4.0

puts( ) only prints a string and a new line

The ceil column is never below x. For 4.2 it gives 5.0, while floor and round both give 4.0 there.

Conclusion. ceil( ) rounds a value up to the next higher integer. The answer is option D, ceil( ).

munotes.in 4

This paper is locked

Get the solved papers to read this paper and every solved paper of this semester.

B.E. First Year (all branches) Semester 2 Previous Year Question Paper Solutions
B.E. First Year (all branches) Semester 2 Notes
Issue

Found an error in this volume? Report it and we will check it against the paper.

Done!