0% found this document useful (0 votes)
78 views6 pages

CP Question Bank-1

H h j no rtyg kiyg bhui nhfyy hhu

Uploaded by

ropoc16581
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)
78 views6 pages

CP Question Bank-1

H h j no rtyg kiyg bhui nhfyy hhu

Uploaded by

ropoc16581
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/ 6

UNIT-1

1. Write an algorithm, flowchart and C program to find the sum of numbers from 1
to ‘n’ [10]
2. Apply software development method on finding the roots of a quadratic
equation.[10]
3. Write detailed notes on C data types. [10]
4. Discuss about the following operators in C language with example.
[4+3+3]
a. Bitwise operators
b. Increment and decrement operators
c. Logical operators
5. Perform the following operations [2+2+2+2+2]
a. 23>>3 b. 27<<2 c. 15&9 d. 15^9 e. 15 | 9
6. (a) Write the structure of C program and explain. [5+5]
(b) Draw the flow chart to find the roots of a quadratic equation for all the cases.
7. (a) Define algorithm. Write algorithm for finding factorial of a number. [4+6]

(b) What is flowchart? Explain different symbols used for flowchart.

8. (a) What is constant? Explain different constants in C. [6+4]


(b) What is variable? Give the rules for variable declaration.
9. (a) Write an algorithm and flowchart to generate Fibonacci series of numbers up
to 'n'.
(b) Write an algorithm and flowchart to find whether the given number is prime or
not. [5+5]
10. (a) Draw the flow chart to find the root of a quadratic equation for all the
cases.[5+5]
(b) Write a C program to find the roots of a quadratic equation for all the cases.

UNIT-2

1. Explain various branching statements in C with examples.


[10]

2. (a) Write and explain about switch statement. [4+6]

(b) Write a Program to perform arithmetic operations using switch.

3. List and explain loop control (or) iteration statements in C.


[10]

1
4. (a) Write and explain syntax of “for” loop.
[3+7]
(b) Write a program to generate prime numbers between 1 and ‘n’.
5. (a) Explain goto statement. Why should we avoid using “goto” statement in
programming?
[5+5]
(b) Write a program to check whether the given number is “Even” or “Odd” using
GOTO statement.
6. List and explain unconditional statements in C with examples.
[10]
7. (a) Write a program to find sum of the individual digits of a given number.
(b) Write a program to check whether the given number is palindrome or not.
8. (a) Write a program to check whether the given number is Armstrong or not.
(b) Write a program to generate ‘n’ Fibonacci numbers.
9. (a) write a program to find sum of the series 1+22 +32+….+n2
(b) Write a program to generate Pascal triangle.
10. Write a program to calculate gross salary for the conditions given below
Basic salary(Rs.) DA(Rs.) HRA(Rs.) Conveyance(Rs.)
>=5000 110% of basic 20% of basic 500
Bs>=3000 and Bs 100% of basic 15% of basic 400
<5000
Bs<3000 90% of basic 10% of basic 300

UNIT-3
Arrays and Strings
1. (a) Define an array. How to initialize one-dimensional array? Explain with suitable
examples.
[5+5]

(b) Write a C program to sort the given array elements in Ascending order.

2. (a) How to declare and initialize a Two-dimensional array? Discuss with examples.
[5+5]

(b) Write a C program to print the Multiplication Table for numbers 1 to n using two
dimensional arrays.

2
3. Write a C program to multiply two matrices of different order.
[10]

4. (a) Write a C program to read and display a 3 by 3 matrix.


[5+5]

(b) Write a C program to add 2 matrices of size n by n.

5. (a) Illustrate multidimensional arrays with example program.


[5+5]

(b) Write a C program to find the largest element given in an array of elements.

6. (a) Write a C program to find the length of a string and reverse the given string
without using string handling functions.
[5+5]

(b) Write a C program to read the elements in an array and print the same in reverse
order.

7. (a) Write a C program to implement strcmp() , strcat() , strcpy() and strlen().


[5+5]

(b) Write a program to find the average marks obtained by a class of 50 students in
a test.

8. (a) Explain declaration and initialization of array of strings.


[4+6]

(b) Write a C program to find whether a given string is palindrome or not.

9. (a) Discus about arithmetic operations on characters.


[5+5]

(b) Write a C program to read a set of strings and sort them in alphabetical order.

10. Explain the following string handling functions with example:


[10]

a. strcpy() b. strcmp() c. strcat() d.strlen() e. strncat()

3
UNIT-4
Functions and pointers
1. (a) What are the advantages of functions?
[3+7]
(b) Write a C program using function to exchange two numbers using pointers.

2. (a) Discuss about the different categories of functions.


[5+5]
(b) Write a C program to illustrate call-by-value parameter passing technique.
3. (a) Write short notes on nested functions.
[4+6]
(b) Write a C program to explain call-by-reference parameter passing technique.
4. (a) What is recursion? What are the advantages and Disadvantages of recursion?
[4+6]
(b) Write a C program to find the GCD of 2 numbers using recursion.
5. Distinguish between the following:
[4+3+3]
a. Actual and formal arguments
b. Global and local variables
c. Automatic and static variables

6. (a) How to access a structure member using pointers, explain with example.
[5+5]
(b) Write a C program to illustrate the use of indirection operator to access the
value pointed by a pointer.
7. (a) What is a pointer? What are the features of pointers? Write a C program to
print address of a variable

4
[6+4]
(b) Explain the declaration of pointers and pointer to pointer with examples.
8. (a) With proper examples explain different arithmetic operations on pointers.
[6+4]
(b) Write a C program to show that pointer of any data type occupies same
space.
9. Explain the following C dynamic memory allocation functions with syntax and
example :
a. malloc() b. calloc() c. realloc() d. free() [10]
10. (a) Explain the concept of array of pointers with examples.
[4+6]
(b) Write a C program to read and print an array of elements using pointers.

UNIT-5
Structures and File management in C
1. (a) Define Structure and write the general syntax for declaring and accessing
members.
(b) How to copy and compare structure variables? Illustrate with example.
[5+5]
2. Write a C program that defines a structure employee containing the details such
as empno, empname, department name and salary. The structure has to store 20
employees in an organization. Use the appropriate method to define the above
details and define a function that will display the contents?
[10]

5
3. (a) Explain the following: [6+4]
i. Nested structures ii. Array of structures
(b) Write a C program to read and display student details using structure.
4. (a) Define union. Give the general template for union. [4+6]
(b) List out the differences between unions, structures and arrays
5. (a) How data elements are stored under unions, explain with example?
[5+5]
(b) Write a C program to illustrate the concept of structure within structure.
6. (a) Write the syntax for opening a file with various modes and closing a file.
[4+6]
(b) Explain the following file handling functions:

a. fseek() b. ftell() c. rewind() d. feof()

7. (a) Write a C program to display the contents of the file in reverse order.
[5+5]

(b) Write a C program to copy the contents from one file to another file.
8. Write a C program to count no.of characters, spaces, lines, words of a file.
[10]
9. (a) Discuss command line arguments in detail with examples.
[5+5]
(b) Write a short notes on
i. fgets() ii. fputs()
10. (a) Explain the following preprocessor directives:
[4+6]
i. #include ii. #define
(b) Write a program in C that reads the name of a file and displays the contents
of the file on the user screen.

You might also like