0% found this document useful (0 votes)
19 views3 pages

UTA003

The document is an examination paper for B.Tech. first-year students at Thapar Institute of Engineering and Technology, focusing on Computer Programming. It includes various programming tasks, theoretical questions, and requires students to write code in C, explain programming concepts, and draw flowcharts. The exam has a total of 35 marks and specific instructions regarding the format and submission of answers.

Uploaded by

thakuraarush19
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)
19 views3 pages

UTA003

The document is an examination paper for B.Tech. first-year students at Thapar Institute of Engineering and Technology, focusing on Computer Programming. It includes various programming tasks, theoretical questions, and requires students to write code in C, explain programming concepts, and draw flowcharts. The exam has a total of 35 marks and specific instructions regarding the format and submission of answers.

Uploaded by

thakuraarush19
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/ 3

Roll No:-

Thapar Institute of Engineering and Technology Patiila


Mid Semester Examination
B.Tech.:- 1" Year (1st Semester) UTACIO3 :- Computer F .ograr•iming
Time:- 2 Hours M:- 35 Faculty Name:- Deep Mann

NOTE: Solve in order and new problem on new page. Assume any missing a rta. No
checking for cuttings or mess:. Give all details to claim full marks.

01 Convert the following: 9..


a) (153)8 = ( )2
b) (289)th = ( )2
c) (100111002= ( )io
d) (13 AB)16.= ( )lo

Q2 Explain the following operators using brief exa 'nples.


(i) Logical (ii) Terna -y (iii) Unary (iv) Arithmetic.
Q3 You are given a group of arbitrary integers that ends with 0. Write
program in C to output the highest number among them.

Example 1:
Input : 4 9 1 0 Output : 9
Example 2:
Input : 2 12 -3 9 :7-:3 0 Output : 33
Q4 Is there any difference between "while" and "do-while" loop. yes,
clearly mention the difference between these two loops with the t- Ip of
an example.

Q5 You are given two positive integers a and b as an input. Write a C 3+3
program to calculate ab with the help of loops. Draw the flowchart to
show the working cf the program.

Q6 Explain the difference between keyword "break" and "continue" vu.ih


the help of an example.
Thapar Institute of Engineering and Technology, Patiala

BE (1st Semester) MST


Date: 6-October 2023 UES103 Programming for Problem Solving
UTA003: Computer Programming I
Time: 3 Hours Total Marks: 35

Faculty: HS Pannu, Raman Goyal, Saif Nalband, Seemu Sharma, Simran Setia, Deep Mann,
Amrita Kaur, Vivek Sethi, Sujata Rani, Prateek Vishnoi

NOTE: Solve all the questions in order otherwise they will not be checked. Only use a blue pen. New
problem, new page. No partial credit for cuttings. Plan on the last page before attempting to avoid
cutting. Assume any missing data. Each question has 5 marks.

Q1. Write short notes on the following with a small example (i) switch case (ii) type conversion.

Q2. Convert the following .


A. 1011 0101 unsigned binary notation into decimal
B. 1011 0101 from 2's complement notation in binary into decimal
C. 1100 1100 from sign-bit binary representation into decimal
D. Convert 121 from decimal into binary
E. Convert -53 from decimal into binary in 2's complement notation

Q3. Draw the flowchart to input a positive integer and find the sum of digits. Carefully use the
conventions of the input box, process box, decision box and the directed edges.

Q4. Find all the syntax and logiscal errors in the given C language program. No explanation
_needed but just list the errors concisely in your answer.

#include<studio.h>
int main() {
int sum;
int k,i;
for(int i=1, i<=10, ++i);
{
sum=sum+k;
k++;
}
printf("The value of sum is %f', sum);
return 0
Q5. Write a program in C language to find if the year is a leap year or not. Below are the rules
for a year to qualify for a leap year.
(a) If the year is divisible by 4 then it is a leap year. For example, year 2024 is a leap year.
BUT
(b) If the year is divisible by 100 then it should also be divisible by 400. For example year 2000
is a leap year but year 2100 is not

Q6. Complete the following C program to find the second smallest number in the array. No need
to re-write the whole program, just write the missing piece.

#include<stdio.h>
int main(){
int n,i,A[] = {4, 34, 9, 1, -5, 2, 8, 11. 15.3}, x

//...fill in the code here

printf("\n%d",x1; // print the second. smallest (x) value

return 0:

Q7. Anagrams are words or phrases that arc formed by rearranging the letters of another
word/phrase. For example, (i) tea and eat (ii) rope and epor.

Write a C program to check whether two input strings are anagrams or not.The input strings may
or may not be a dictionary word.

You might also like