C_Programming(1)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

211095

Reg No:___________________________ Name:_____________________________


RAJAGIRI SCHOOL OF ENGINEERING & TECHNOLOGY
(Autonomous)

Second Semester B.Tech Degree Examination

September - October 2021

Course Code : 100908/CO200G


Course Name : C Programming

Max.Mark:100 Duration: 3 hours


PART A

Answer all questions

1 Differentiate between compiled and interpreted languages. (3)


2 What is the difference between low level language and high level language? (3)
3 What is sizeof() operator in C? Write two examples. (3)
4 What are the logical operators in C? Give examples (3)
5 Explain the different methods for declaring and initializing a two dimensional (3)
array of size 3 x 2.
6 Write a C program to count the number of words in a sentence. (3)
7 What is the purpose of an automatic variable? What is its scope? (3)
8 Give three advantages of using functions in a program. (3)
9 With the help of an example, compare getc() and putc() functions in file (3)
operations.
10 What does the variable ‘x’ specifies in the following declarations in C? (3)

i) Float *x ii) Float *x[10]


PART B

Each question carries 14 marks

11 i) Write an algorithm to find the reverse of a number. (14)

ii) Draw a flowchart to find whether a number is palindrome or not.


OR

12 i) Write an algorithm to find the sum of digits of a number. (14)

ii) Draw a flowchart to count the number of digits of an integer.

Page 1 of 3
13 Explain the following with example:- (14)

i) What happens if 'break' statement is not used in a switch case statement.

ii) What is the use of 'default' statement in a switch case statement

iii) What is an unconditional jump

OR

14 Write a C program to input electricity units consumed and calculate the total (14)
electricity bill according to the given condition:
i) For first 50 units Rs. 0.50/unit
ii) For next 100 units Rs. 0.75/unit
iii) For next 100 units Rs. 1.20/unit
iv) For unit above 250 Rs. 1.50/unit and
v) An additional surcharge of 20% is added to the bill.

15 Write a program to read a two-dimensional array and do the following (14)


operations
i) Print the sum of main diagonal elements.
ii) Print largest element in the matrix
OR

16 i) Write a program to print the sum of all odd numbers and even numbers (14)
separately in an array
ii) Write a program to read an n x m matrix and print the transpose of the matrix.

17 i) Create a structure of bank customer with customer details like customer (14)
name, customer id, customer account balance and type of account. Write a
function to read and print the details of a customer.

ii) Write a program to find the factorial of a given number using recursive and
non recursive methods
OR

18 i) Write a program to pass an integer array to a function and find the sum of the (14)
digits of all elements in the array

ii) Write a program to pass an string to a function and find the count of special
characters excluding ‘$’.

Page 2 of 3
19 Create two text files and write a program to add the contents of one file at the (14)
end of another file.
OR

20 Write a C program to perform the following operations using pointers. (14)

i) Read a string

ii) Convert lowercase letters to uppercase letters.

꧁__________________________________________________________________꧂

Page 3 of 3

You might also like