You are on page 1of 7

MODULE 1 : 4 MARKS

1. Give the equivalent C expression for ) +log2a

2. Explain the significance of the following control specifiers in input and output
statements:

a) %c b) %o c) %x d) %d

3. What is a variable? How are keywords different from them/

4. Write down the syntax of the conditional operator and explain with an
example.

5. Describe and explain the various data input statements available in C


language

6. Find out the output of the following program:

#include<stdio.h>

Main()

Int i=7;

Float x=3.5;

I=9/2+x+i/2;

Printf(“%d”,i);

7. How can the getchar function be used to read multicharacter strings?

8. What is meant by operator precedence? What are the relative precedences of


arithmetic operators in C?

9. List any 4 keywords and explain their use.

10.What is the purpose of getchar function? How it is used within a C program?

11.Give the syntax and describe the logical NOT operator. What is its purpose?

12.What is a variable ? How variables in C are characterized?

MODULE 1: 12 MARKS

1. Write a C program to read a 6 digit number and print it in reverse order.


2. How various data types in C are classified? (8)Explain with appropriate
example.Explain the scanf and printf statements with examples.(4)

3. Summarize a convenient method for entering a string of undetermined


length, which may contain whitespace characters, and which is terminated by
a carriage return. Explain relative to the type of conversion required with the
control string of a scanf function.(8)

What are the differences between f, e, g type conversions when outputting


floating point data with a printf function? Give examples.(4)

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)

5. Write an interactive C program to read the half life period of a radioactive


element and determine the time at which p% elements disintegrate; the half
life period is evaluated as

, where K=

6. Write a program to find the slant surface area of a cone as πr

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?

9. Describe 2 logical operators in C. What is the purpose of each? With what


types of operands can they be used? What type of expression is obtained?
What are the different conversion characters within the control string of a
printf function? Compare with the conversion characters that are used in a
scanf function

10.What are unary operators? Describe 6 unary operators mentioning their


purposes?

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?

Are library functions a part of C language. Explain?

12.How can precision be specified within a printf function?

Write a C program to compute the real and complex roots of a quadratic


equation/

MODULE 2: 4 MARKS

1. Clearly explain the functioning of break and continue statements with


examples.

2. Write the rules that apply to a function call in C. Explain with an example.

3. What is the purpose of goto statement? How is the associated target


statement identified? 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.

5. Can loops be nested within if-else statements? Can if else statements be


nested within loops? Explain.

6. Summarize the rules associated with function prototype. What is the purpose
of each item or group of items?

7. Describe the 2 different types of if else statement. How do they differ?

8. What are the 2 main components of a function definition/ Illustrate.

9. Summarise the syntactic rules associated with if else statement.

10.Write a C program to compute and return the factorial of a positive number.


11.What is a function? State 3 advantages to the use of function

MODULE 2: 12 MARKS

1. Write a c program to convert a given decimal number into its equivalent


binary number.

2. Write a recursive function to find the factorial of a given number and use it to
find:

3. Write a c program to read a given string of characters and display it in the


reverse order.show with the help of examples, how does a main function
differ from other user defined functions, through it is also a user defined
function?

4. Write a c program that reads 100 integers and find how many of them are
prime numbers.

5. Write a program that includes a recursive function to determine the value of


the nth Fibonacci number.

6. Write a c program, which finds the number of characters occur consecutively


more than 2 times in a string of 100 characters generated as input.

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%.

11.Write a c program to determine the sum of digits of a given number.

MODULE 3: 4 MARKS

1. What is the relationship between a member and a structure? Explain with an


example.

2. Mention the advantages of structures over union type.


3.

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%

2. Write a c program to find the maximum and minimum in array of 100


integers and their locations?

3. Write an interactive program that reads N different names and addresses of


candidates into the computer, along with their date of birth and rearranges in
the descending order of their date of birth and prepare the roll list output in
the order.

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.

5. Write a program to read 1000 different names and addresses of candidates


into the computer, rearranges them in the alphabetical order of their names
and prepare the name address output list.

6. Write a c program to compute the determinant of a 3 x 3 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.

10.What are subscripted variables? Write a c program to read 2 matrices and


calculate their product, if they are conformable for multiplication.

11.Read in the first m elements of a one dimensional floating point array.


Calculate the sum of these elements, the mean and the standard deviation
MODULE 4: 12 MARKS

1. Declare 3 pointer variables to store a character, a character string and an


integer respectively. Input values into these variables. Display the address
and the contents of each variable.

Write a C program using pointers to multiply 2 integers.

2. Using pointers, write a C program to sort the given list of numbers in


ascending order.

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.

4. Write a c function that receives a number n and returns a pointer to a


character string containing the name of the corresponding day. The day
names should be stored in a static table of character strings local to the
function.

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.

Write a program to read a sentence and replace the lowercase characters


by uppercase and vice versa.

7. Write a c program to count the no; of vowels, consonants, constants, digits,


whitespace characters and other characters in a line of text.

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.

10.Write a c program that determine whether a string is palindrome or not.

11.Write a c program to read identification no;,name and salary of 74 employees


in a firm and prepare the pay roll list in the descending order of the salaries.

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.

4. Write an interactive file oriented c program to generate a data file containing


the students’ register number, name and marks scored in 8 subjects. Create
a report containing the name, register number, exam scores and average
grade for each student.

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.