Professional Documents
Culture Documents
2. Explain the significance of the following control specifiers in input and output
statements:
a) %c b) %o c) %x d) %d
4. Write down the syntax of the conditional operator and explain with an
example.
#include<stdio.h>
Main()
Int i=7;
Float x=3.5;
I=9/2+x+i/2;
Printf(“%d”,i);
11.Give the syntax and describe the logical NOT operator. What is its purpose?
MODULE 1: 12 MARKS
4. How can short integer, long integer and double precision arguments be
indicated within the control string of a printf function? How can long double
arguments be indicated? Illustrate with the help of examples.(6)
If a and b are 2 sides of a triangle and q is the included angle of the sides,
the third side c is given by c2=a2+b2-2abcosq. Write an interactive C program
to read a, b and q and calculate and print the third side c.(6)
, where K=
If a and b are two sides of a triangle and q is theangle included of the sides,
the area of the triangle is given by absinq . Write an interactive C program to
read a, b, q and calculate and print the area of the triangle.
7. How can the precision be specified within a print f- function? Explain with the
help of examples, how an interactive dialog can be generated by repeated
use of pairs of scanf and printf functions. What is the purpose of flags used
with the printf function?
8. What is meant by a field? How can the maximum field width for different
types of data items be specified with scanf function? Describe the 4 relational
operators in C. With what type of operands can they be used? What type of
expression is obtained?
What are the purpose of the flags that are used within the printf function?
Can 2 or more flags appear consecutively within the same characters group.
Explain with examples.
11.Describe with the help of examples, all the operators in C, specifying the
hierarchy of operations?
MODULE 2: 4 MARKS
2. Write the rules that apply to a function call in C. Explain with an example.
4. How is the first line of a function definition written? What is the purpose of
each item, or group of items? Give examples.
6. Summarize the rules associated with function prototype. What is the purpose
of each item or group of items?
MODULE 2: 12 MARKS
2. Write a recursive function to find the factorial of a given number and use it to
find:
4. Write a c program that reads 100 integers and find how many of them are
prime numbers.
7. Write a C program to find out and print all the three digit prime numbers.
8. Write a c program to add the digits of a given positive number and print
them.
9. Write a C program to generate the first 100 terms of the Fibonacci series ad
print their sum and average.
10.Write a C program to calculate and print the deposit amount and maturity
amount for one to 5 years in a bank, which offers interest at the rate of
7.75%.
MODULE 3: 4 MARKS
MODULE 3: 12 MARKS
1. Bring out the meaning of array of structures. Write a C program to read the
following information of 60 students; student name, roll no, and marks in 8
subjects. Print the roll no and names of the students who have secured more
than 60%
4. Write a C program to check whether the given 2 matrices are conformable for
multiplication, and if yes, calculate and print the product matrix.
7. Write a C program that will enter a line of text, store it in an array and then
display it backwards. Allow the length of the line to be unspecified, but
assume that it will not exceed 80 characters?
8. A square matrix, one having the same no; of rows and columns is called a
diagonal matrix if its only non zero elements are on the diagonal. It is called
upper triangular matrix if all elements below the diagonal are 0 and lower
triangular if all elements above the diagonal are 0. Write a C program to
determine whether a given matrix is anyone of the above types.
9. Each row of Pascals triangle begins and end with 1’s and each numbers in the
interior is the sum of the numbers on the either side of it in the row above.
Write a C program to compute and print the first 10 rows of the Pascals’
triangle.
3. A common mistake in typing occurs is that the same word is typed more than
once. Write a program that finds such words and the line numbers on which
they occur in the input. It may be noted that a sentence in the input may
span more than one line, and there may be more than one sentence on one
line.
5. Write a function using pointers to add 2 matrices and to return the resultant
matrix to the calling functions.
6. Write a program to read N integres and find the sum of all these elements
using pointers.
8. Write a C function that locates the first occurrence of a character string inside
another string.
9. Write a c program which counts the total no: of words and the total no: of
vowels in a given line of text.
MODULE 5: 12 MARKS
1. Write a C program to read a line of text from a file and display the text on the
screen.
2. Write a C program using macros to find the largest of 2 numbers. What are
the merits of using macros.
3. Write a c program to store students’ names and birth dates with an array
using bit fields for the birth dates. Display each students’ name and birth
date.
5. Write a file oriented program that will maintain a list of names, addresses and
telephone numbers in alphabetical order. The information associated with
each name is to be processed as separate record. Represent each record as a
structure.
6. Explain how to open and read data from a sequential file that has already
been created? Write a c macro that converts a character to uppercase if it is
a lowercase letter and leaves it unchanged otherwise.
7. Write a c program to add new customer records old records can be deleted
and also the existing ones can be modified?
8. Write a c program that will read successive records from the new data file
and display each record on the screen in an appropriately formatted form?
9. What are the different ways in which data files can be categorized in C? For
what kind of applications are the informatted data files most suited? Explain
with an example.
10.Associate a stream pointer pointr with a new stream oriented data file called
sample.dat.Open the data file so that information can either be read from or
written into the file. Show how the data file can be closed at the end of the
program.