[go: up one dir, main page]

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

2131

Uploaded by

Sreekanth Ku
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)
28 views4 pages

2131

Uploaded by

Sreekanth Ku
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

TED (21) – 2131 REVISION 2021

SECOND SEMESTER DIPLOMA EXAMINATION IN ENGINEERING


AND TECHNOLOGY
(Common to CM / CC / CF / CN / CT / IF)

PROBLEM SOLVING AND PROGRAMMING


MODEL QUESTION PAPER

Time: 3 hours Maximum Marks: 75

PART A

I. Answer all questions in one word or one sentence. Each question carries one mark.

(9 x 1 = 9 Marks)

1 The -------------- function is used to display output on the screen M 1.03


1.0 R
Let x and y are two integer variables and y = 10. What is the value
2 M 1.03
1.0 U
of x after executing the statement x = y++;
3 Write syntax of do – while loop M 2.04
2.0 R
4 -------statement
statement in C is used to exit from the current loop M 2.07
2. R
5 && is a --------------operator
operator M 2.02
2.0 R
6 By default, --------- is the return type of C function M 3.01 R
Normally a function can return a single value at a time( state
7 M 3.01 U
True/False)
8 Define array. M 4.01 R
The statement A[] = {{1,2,3}, {4,5,6}} will declare an array of
9 M 4.03
4.0 U
size --------------

PART B

II. Answer any eight questions from the following. Each question carries 3 marks

(8 x 3 = 24 Marks)
Area of a triangle is given by the formula

where a, b and c are the sides of the


1 M 1.01 A
triangle .
Draw a Flow chart to find the area of triangle for given values.
Describe about precedence and associativity of operators with
2 M 1.03 U
example
3 Write the syntax of if – else ladder. Also give an example M 2.03 R
Let no = 10, write the output of the following program segment.
int first = 0;
int second=1;
int next,i;
for(i=0; i<no; i++){
4 M 2.04 U
printf(“%d\t”,first);
next = first + second;
first = second;
second = next;
}
The following code segment is expected find the sum of first n
natural numbers. Identify the error in the program segment.
int i = 0, sum ;
5 M 2.04 U
while (i>n)
{sum = sum+i;
}
Rewrite the following code using while loop
6 for (i=0;i<n;i++) M 2.04 U
printf(“%d”,i);

Explain any 3 built in functions with example M 3.01 R


7
Differentiate between a function prototype, function definition and
M 3.01 U
8 a function call.
9 Explain the declaration, initialization of a two dimensional array M 4.04 R

In the array declaration double score[5]; state the following:


a) The array name M 4.01 U
10
b) The range of values that an index for this array can have

PART C

Answer all questions. Each question carries seven marks

(6 x 7 = 42 Marks)
III a) Describe the steps in compiling and executing a C program M 1.02 R
3 Marks

b) Given 2 integer variables Draw a flowchart to interchange M 1.01 A


the values of these variables without using a third variable.
Eg: Suppose initially a=10 and b=20 output a=20 and b=10
4 Marks
OR
IV a) Explain different arithmetic and relational operators in C M 1.03
1 R
3 Marks

b) Write a program to convert Fahrenheit temperature into M 1.04 A


degree Celsius (c=(f-32)*5/9)
32)*5/9)
4 Marks
V a) Distinguish between dodo-while and while looping statements in M 2.04 R
C with the help of example
examples
3 Marks
b) Write a program to find quadrant of a point (x,y).
(x,y) M 2.03
2 A
For eg;(2,-3)
3) in fourth quadrant
4 Marks
OR
VI a) Write the syntax of for loop statement. Give an example M 2.04
2 U
3 Marks

b) Write a program to find the roots of a quadratic equation M 2.03 A


ax2+bx+c=0 based on the determinant
4 Marks
VII Write a program to check the given number is prime or not M 2.05
2 A

OR
VIII Write a program to find the sum of odd numbers and even M 2.05
2. A
numbers from a given set of numbers

IX a) Explain function declaration , function call and function M 3.01


3. U
definition with the help of an example
3 Marks

b) Write a function to find the largest from two numbers and use M 3.03
3. A
this function to find largest number among four numbers
4 Marks
OR
X a) Explain the procedure for passing arguments in function M 3.02
3. R
3 Marks

b) Develop a function to find the factorial of a number. Using this M 3.03


3. A
function write program to find

nCr =
4 Marks
XI The algorithm to convert decimal to binary is given below. Write a M 4.02
4. A
C program for the same.

i. Read the number


ii. Store the remainder when the number is divided by 2 in an
array.
iii. Divide the number by 2
iv. Repeat the above two steps until the number is greater than
zero.

Print the array in reverse order now.

OR
XII Write a program to find the largest elements in an array. M 4.02 A

XIII Write a program to do the following M 4.04 A

a) Read order of a matrix


b) Read elements of that matrix
c) Print the elements in matrix form
d) Print the sum of elements of the matrix.

OR
XIV Write a program to do the following M 4.04 A

a) Read an M by N matrix
b) Check this matrix is a square matrix
c) If above matrix is symmetric ,find the sum of diagonal
elements

You might also like