Professional Documents
Culture Documents
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”.
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.
Ans: On the front of 62, we have 61. The rest of the pages are 81-p
So,
81-61=20
81-62=19
#include <stdio.h>
int main() {
int x=0, y=10;
if((x=0) || (y=0))
printf("Hello");
else
Ans:
World
x=0 y=0
State whether these statement are True or False with proper justification.
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)
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:
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
Therefore
98*3*X-199X=2850
X=2850/95
X=30
Y=90
Solution
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
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?
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)