0% found this document useful (0 votes)
14 views4 pages

End (2021)

This document outlines the end term exam for the Computer Science & Engineering department at Maulana Azad National Institute of Technology Bhopal, scheduled for June 28, 2021. It includes details such as the course, subject code, maximum marks, and instructions for submission. The exam consists of various programming tasks in C, including games, mathematical calculations, and file manipulation.

Uploaded by

abc747388
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)
14 views4 pages

End (2021)

This document outlines the end term exam for the Computer Science & Engineering department at Maulana Azad National Institute of Technology Bhopal, scheduled for June 28, 2021. It includes details such as the course, subject code, maximum marks, and instructions for submission. The exam consists of various programming tasks in C, including games, mathematical calculations, and file manipulation.

Uploaded by

abc747388
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/ 4

MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY BHOPAL

END TERM EXAM JUNE 2021

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Course: B. Tech Semester: II Branch: Group B

Subject: Computer Programming Subject Code: CS114 Date: 28/06/2021


Max Marks: 50

Attempting Time: 9:30 AM to 12:30 PM


Submission / uploading time: 12:30 PM to 1.00 PM (30 Minute)
Note: 1. Don’t wait till the deadline to upload, do it as soon as you finish your paper
2. Reply and upload the answer sheet in single pdf file with filename as your roll number (for
example: 20E004.pdf)
3. All questions are compulsory.
4. You need to add sample output for all questions

1 Lets find what is the final outcome of the board game by seeing the final 10
board. The board is a 3×3 matrix. Each board position can have either 0 or 2
as elements. If T0 represents total number of 0’s in matrix, T2 represents total
number of 2’s in matrix, then it must satisfy condition T0=T2+1 or T0=T2-
1.If condition between T0 and T2 fails, “invalid player movement” message is
displayed. Now if all 3 elements of any row or column are same (0 or 2) or all
3 elements of diagonal position are same (0 or 2) then display “(0 or 2)-You
win the Match”. If above condition fails, then display “Match Draw”.

Write C program to take all 9 inputs of 3×3 matrix and display matrix. Then
check above conditions to find final outcome of the match (0 or 2 wins match,
match draw) and display message accordingly

Sample Wining Game.


0 2 0 0 0 2 0 0 0

0 2 2 0 0 2 0 2 2
0 0 2 2 2 0 2 0 2
2 Lets design and play a game with marbles. We have one 4*4 main 10
board(MB) and one 1*1 side board (SB) as shown below .Initially 28
marbles are there in SB. We can pick any number of marbles from side
board(SB) and place it in any position / place in MB except the 4 positions
marked as X in MB. However we need to place the marbles in such a way
that following condition always satisfied - total no. of marbles in
row1,row4,col1,col4 are 8.We will repeat this process as shown in the
diagram .After the first step ,6 marbles are left in SB .In the 2nd step ,we
pick one marble from SB (so 5 marbles are left)and place it in row1 of
MB and then rearrange marbles in other place to satisfy the condition-
total no. of marbles in row1,row4,col1,col4 are 8. Step3 and step4 are also
shown to understand the game. You need to show the remaining steps (till
0 marbles left in SB) displaying no. of marbles in row & col you place in
a way so that condition - total no. of marbles in row1,row4,col1,col4 are 8
is satisfied. Highlight with square marks (as shown in step2-4) the
position in MB where you add new marble and rearranged marbles to
satisfy condition.

Also write c program to display the final output of each step (no need to
display internal stepwise rearrangement output) of this game. Display 0 in
place of X of MB.
3 Write a program to take last two decimal digits of your roll no as input and 5
find least significant byte (LSB) of it. Now check if first 4bits of LSB are
equal to last 4 bits of LSB or not. For example if LSB is 1000 1000 then
output will be "Equal" and if LSB is 1000 1010 then output will be "Not
equal".
4 Write a program to calculate the sum of the factorial of each individual digit 5
of a number
5 Write a program to print the below given series using recursion 5

1,2,5,12,29,70,169
6. Write a program that takes two integer type numbers as input and display 5
results of following operations between them - BITWISE AND (&),
BITWISE OR (|) based on choice '&' or '|' entered by user. Use function int
Bitwise(int,int,char) to compute and store result of operation. Also use
switch-case in the program. Display output of your program by taking your
roll no and next roll no as two inputs and choice '&' or '|'.

7. Write a program that replaces a word ‘hello’ with another word ‘bye’ in a file 5
"test.txt", and return total number of replacements.
8. Write a program that will take information of all the students from a user. 5
Each individual student's information will be stored in a record, where a
student record will have three fields, which are student name, age and height.
The number of records will be equal to the number of students in a class. In
addition, the program also has to print the record of each student using the
pointer.

You might also like