You are on page 1of 8

Jaypee Institute of Information Technology, Noida

Department of CSE&IT

Test 1 Examination-2021-22
B. Tech-1st Year
Course Title: Software Development Fundamentals - 1
Course Code: 15B11CI111
Maximum Marks: 20
Maximum Time: 01 Hr

Note:
1. This is a paper and pen examination. Answers have to be written on papers only in
your own handwriting. No answer has to be given on Google form.
2. On the top of your answer sheet, write your Name, Enrolment no, Batch and Date of
exam, Course name and Course Code.
3. Answer should be uploaded collectively at the end of the Examination.
4. Save the T1 Answer script file with the name as “studentenroll_ studentname_Batch”.

Section 1: Short Answer Questions (Marks 10)


Note: Attempt all questions

1. [CO3][1 Mark]: You are required to check whether the number entered by the user is
prime or not. What is the minimum number of decision boxes required to accomplish this
task? Assume that the numbers entered are integer numbers.
Ans: 3
a) One for checking if the number is a positive integer
b) One checking remainder
c) One for checking for loop condition.

2. [CO1][1 Mark]: In a printing press, a magazine is made by folding 20 large sheets of


paper in half. The total number of pages in the magazine is 80. The first sheet contains
pages numbered as 1, 2, 79, 80. A sheet is selected which contains the page number 62.
What are the other page numbers this sheet contains?

Ans: On the front of 62, we have 61. The rest of the pages are 81-p
So,
81-61=20
81-62=19

Thus, pages on the sheets are 61,62,19,20

3. [CO2][1 Mark] What is the output of the following code snippet?

#include <stdio.h>
int main() {
int x=0, y=10;
if((x=0) || (y=0))
printf("Hello");
else

*** ALL The Best ***


printf("World");
printf("\nx=%d y=%d",x,y);
return 0;
}

Ans:
World
x=0 y=0

4. [CO2][1 Marks] Consider the following statements:

I A ‘if-else’ ladder is equivalent to ‘switch-case’ for an expression/condition resulting


in a floating point value.
II Modulus operator (%) cannot be applied on character operands.

State whether these statement are True or False with proper justification.

Ans: I. False II False


0.5 marks each

5. [CO2][1.5 Mark] What are the final values of a,b,c,d,e variables in the following code?
Provide proper justification

#include <stdio.h>
int main()
{
int a = 1;
int b = 1;
int c = (++a ||b++)*(a++ * ++b);
int d = (++b*a--)%a;
int e = (c--*++b/a--) && a--;
printf("a=%d, b=%d, c=%d,d=%d e=%d",a,b, c,d,e);
}

Ans:
a=0, b=4, c=3,d=1 e=1
0.5 for each value of c,d,e

6. [CO2][1.5 Mark] Predict the output of the following code with proper justification.

#include<stdio.h>
void main()
{
int a = 4, flag=1;
while(flag)
{
switch(a)

*** ALL The Best ***


{
case 128:
printf("A");
a=a*8;
break;
case 256:
printf("B");
a=a*2;
break;
case 512:
printf("C");
a=a/4;
break;
case 1024:
printf("D");
a=a%2;
break;
case 0:
flag=0;
break;
default:
a=a*a;
}
}
}

Ans: BCAD

1 for output
0.5 for justification or dry run

7. [CO2][1.5 Marks] Complete the following code(line no. 3, 4 & 5) to get the desired
output as:

OUTPUT:
JIIT

#include <stdio.h>
int main(){
int a= 7, b=_____, c=45.3+35.6; //Line no.3
char ch1=____, ch2='S', ch3=_____; //Line no. 4
printf(“_________”,a+ch1,b-ch2,b-ch2,ch3%5+c); //Line no. 5
return 0;
}

Ans: b=156 , ch1='C' , ch3='E' , %c%c%c%c

0.5 for each of the blank (except last)

*** ALL The Best ***


8. [CO1][1.5 Marks] Sharad asks his friend Ramesh for the loan of X rupees and Y paise.
While asking for laon, Sharad knows that the amount of paise asked by him is thrice the
amount of rupees asked. However, Ramesh didn’t heard him clearly and handed him Y
rupees and X paise. After spending Rs. 28.50, Sharad realises, he has double the amount
which he asked as loan. What is the amount asked by Sharad as loan? Justify your
answer.

Ans:
As given, the person wanted to withdraw 100X + Y paise.
But he got 100Y + X paise.
After spending 20 paise, he has double the amount he wanted to withdraw. Hence, the
equation is
2 * (100X + Y) = 100Y + X - 2850
200X + 2Y = 100Y +X - 2850
199X - 98Y = -23
98Y - 199X = 2850

Now, we got one equation; but there are 2 variables.

We also know that


Y=3X

Therefore
98*3*X-199X=2850
X=2850/95
X=30
Y=90

Amount asked by him: Rs. 30.90

1 marks for answer, 0.5 for justification

Section 2: Long Answer Questions (Marks 10)


Note: Attempt all questions

*** ALL The Best ***


9. [CO3][2 Marks] Draw a flowchart to find the sum of series after taking number of terms
(n) from the user. The sum of series is calculated using odd numbers only. The first two
numbers in the series are subtracted then next two terms are added, then next two
subtracted. The process continues till n.
For example, if number of terms = 5, then sum is calculated as follows:
S=1-3+5-7+9
If number of terms =7, then sum is calculated as follows:
S= 1-3+5-7+9-11+13

Solution

1.5 marks for correct algorithm and control flow.

Deduct 0.5 marks if any box is missing or incorrectly used.

10. [CO2][3Marks]
*** ALL The Best ***
An infectious disease is turning into a pandemic and spreading very fast. There are N
cities, numbered from 0 to (N−1), arranged in a circular manner. City 0 is connected to
city 1, 1 to 2, …, city (N−2) to city (N−1), and city (N−1) to city 0.The virus is currently
at city X. Each day, it jumps from its current city, to the city K to its right, i.e., from city
X to the city (X+K)%N. As the virus jumps, the cities in between don't get infected.
Cities once infected stay infected. You live in city Y. Find if it will reach your city
eventually. If it will, print YES, else print NO. Your program should take four space-
separated integers as input– N,K,X andY, denoting the number of cities, the size of jumps,
Covid's current city, and the city that you live in, respectively. The program should print
YES if Covid shall reach your city after a finite number of days, else print NO.

Test Case 1:
12 3 1 4
YES

Test case 2:
10 2 1 4
NO

Solution:

#include <stdio.h>
int main()
{
int n,k,x,y,c=0;
int f=0,c=0;
scanf("%d%d%d%d",&n,&k,&x,&y);
while(c<=n-1)
{
x=(x+k)%n;
if(x==y)
{
f=1;
break;
}
else
c++;
}
if(f==1)
printf("YES\n");
else
printf("NO\n");
return 0;
}
1 marks for correctly taking input and displaying output
1 marks for correct implementation of loop
1 marks for correct condition checking.

11. [CO1][1+1 Marks]: Shyam is a software developer designated as a team leader in ABC
company. A new project has been assigned to his team. As a part of new project a billing
software application need to be developed for some client. All his team members are

*** ALL The Best ***


newly assigned to his team without any prior experience of developing any such billing
application.

a) Can you suggest an appropriate SDLC model to be used in this scenario?

Ans: Prototype. (0.5 for answer 0.5 for justification)

b) After rigorous software development process Shyam and his team members
completed the project in three months and delivered to the client. Now client reported
some bugs in the software. Which phase of SDLC, we are currently in?

Ans: Maintenance (0.5 for answer 0.5 for justification)

c) [CO2][3 Marks] Write a C program to write the first five characters of your name in
the following pattern.

N
NA
NAM
NAME
NAMES
NAME
NAM
NA
N

Solution:

#include <stdio.h>
//#include <conio.h>
void main()
{
int num,k, i, j, m = 1; // declare local variables
printf (" Enter the number of characters in your name: \n");
scanf ("%d", & num);
char c1, c2, c3,c4, c5;
printf(" Enter character-1 of your name:");
scanf(" %c", &c1);
printf(" Enter character-2 of your name:");
scanf (" %c", &c2);
printf (" Enter character-3 of your name:");
scanf (" %c", &c3);
printf (" Enter character-4 of your name:");
scanf (" %c", &c4);
printf (" Enter character-5 of your name:");
scanf (" %c", &c5);
for (i = 1; i <= num; i++)
{
for (j = 1; j <= i; j++)
{
if(j==1)
printf( "%c", c1);
if(j==2)
printf( "%c", c2);
if(j==3)

*** ALL The Best ***


printf( "%c", c3);
if(j==4)
printf( "%c", c4);
if(j==5)
printf( "%c", c5);
}
printf("\n");
}
for (i = num-1; i >= 1; i--)
{
for (j = 1; j <= i; j++)
{
if(j==1)
printf( "%c", c1);
if(j==2)
printf( "%c", c2);
if(j==3)
printf( "%c", c3);
if(j==4)
printf( "%c", c4);
if(j==5)
printf( "%c", c5);
}
printf("\n");
} }

*** ALL The Best ***

You might also like