SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203
(AN AUTONOMOUS INSTITUTION)
DEPARTMENT OF
GENERAL ENGINEERING
QUESTION BANK
II SEMESTER
Programming in C
Regulation – 2019
Academic Year 2019 – 2020
(Even Semester)
Prepared by
Mr. S.K. Saravanan,AP Mr.M.Asan Nainar, AP
Mrs. M. Shanthi, AP Mr.Sowrirajan AP
SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203.
DEPARTMENT OFGENERAL ENGINEERING
QUESTION BANK
SUBJECT : Programming in C
SEM / YEAR: Second Semester / 1st Year
UNIT I - BASICS OF C PROGRAMMING
SYLLABUS
Introduction to algorithm: Flowchart-Pseudo code- Introduction to programming
paradigms- C programming: Data Types -Keywords-Variables and Constants–
Operators and Expressions: Expressions -precedence,-associativity-Input/Output
statements-Decision making and looping: Branching statement ,Iterative statement -
Compilation process.
PART - A
Q.No Questions BT Level Competence
1. Define programming paradigm. BTL -1 Remember
2. Write the advantages of flowchart. BTL -1 Remember
3. Distinguish between character and string. BTL -2 Understand
4. What are keywords? Give an example. BTL -1 Remember
5. What do you mean by expression? BTL -1 Remember
6. Identify the use of ternary or conditional operator. BTL -4 Analyze
7. What is mean by Operators precedence? BTL -2 Understand
8. What is the use of sizeof()? BTL -1 Remember
9. How to create enumeration constants? BTL -4 Analyze
10. Differentiate between variable and constant. BTL -4 Analyze
11.
What is the output of the programs given below?
#include <stdio.h>
main()
{
int a = 20, b = 10, c = 15, d = 5; BTL -3 Apply
int e;
e = (a + b) * c / d;
printf("Value of (a + b) * c / d is : %d\n", e );
}
12. Generalize the types of I/O statements available in ‘C’. BTL -6 Create
13. What is header file? Why they are important? BTL -1 Remember
14. Show the difference between while and do-while. BTL -3 Apply
15. Invent the difference between ++a and a++. BTL -6 Create
16. Differentiate switch and nested-if statement. BTL -2 Understand
17. Summarize the various types of C operators. BTL -5 Evaluate
18. Recommend the suitable example for infinite loop using
while. BTL -5 Evaluate
19. Classify the narration of compiler and interpreter. BTL -3 Apply
20. Distinguish between break and continue. BTL -2 Understand
PART - B .
1. Describe the structure of a C program with an
example.(13) BTL -1 Remember
2. Discuss about the constants, expressions and Decision
BTL -2 Understand
making statements in ‘C’. (13)
3. Illustrate about the various data types in ‘C’ and write a
C program to find the sum of 10 non-negative numbers BTL -3 Apply
entered by the user.(13)
4. (i) Explain the different types of operators used in ‘C’
with necessary program. (8)
BTL -2 Understand
(ii) Write a C program to check the integer is
Palindrome or not.(5)
5. Explain in detail the operation of various looping BTL -1 Remember
statements in C with suitable examples.(13)
6. Write a menu driven program in C to perform various
arithmetic operations. BTL -1 Remember
7. Illustrate a program to find out the average of 4 integers
BTL -3 Apply
with the help of flowchart. (13)
8. Discuss about pseudo code and explain with an
example(13) BTL -2 Understand
9. Explain the following:
i. Keywords (3) ii. Identifiers (3)
iii. C character set (3) BTL -5 Evaluate
iv. Constants (4).
10. Write a C program for the following :
(i). To check whether a given year is leap or not.(5) BTL -4 Analyze
(ii). To find the roots of a quadratic equation.(8)
11. Develop a C program for the following :
(i). To find the area and circumference of a circle with
radius r.(6) BTL -6 Create
(ii). To find the sum of first 100 integers.(7)
12. Write a C program for the following :
(i). To find the sum of the digits of a number.
(123 => 1+2+3=6.(7) BTL -4 Analyze
(ii). To find the sum of all odd / even numbers
between 1 and 100.(6)
13. Write a C program for the following :
(i). To generate the first n numbers in a Fibonacci
series.(7) BTL -1 Remember
(ii). To find the factorial of a given number.(6)
14. Write a C program to generate Armstrong number
between 100 and 999.(13) BTL -4 Analyze
PART-C
Develop a C program for the following :
(i) To check whether a number is prime or not.(8)
1. (ii). To convert the temperature given in Fahrenheit to BTL -6 Create
Celsius and vice versa.(7)
Compare and contrast branching and looping
2. statements.(15) BTL -5 Evaluate
Design a C program to convert the given decimal number
3. into binary, octal and hexadecimal numbers. (15) BTL -6 Create
Summarize on algorithm, flowchart and pseudo code
4. with an example.(15) BTL -5 Evaluate
SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203.
DEPARTMENT OF GENERAL ENGINEERING
QUESTION BANK
SUBJECT : Programming in C
SEM / YEAR : Second Semester / 1st Year
UNIT II -ARRAYS AND STRINGS
SYLLABUS
Introduction to Arrays: One dimensional array: Assigning an array to another array –Equating
an array with another array-Two dimensional Arrays: Declaration-usage of two dimensional
array-reading, storing and accessing elements in two dimensional array-memory
representation-String operations: String library functions- list of strings-command line.
PART - A
Q.No Questions BT Level Competence
1. List out the advantagess of Arrays. BTL -1 Remember
2. Define a float array of size 5 and assign 5 values to it. BTL -1 Remember
3. Identify the way to assign an array to another array. BTL -4 Analyze
4. What is an array? Write the syntax for array.
BTL -1 Remember
5. What will happen when you access the array more than
BTL -1 Remember
its dimension?
6. Point out an example code to express two dimensional
BTL -4 Analyze
array.
7. How to create a two dimensional array? BTL -2 Understand
8. What is the method to equate an array? BTL -3 Apply
9. Distinguish between one dimensional and two
BTL -4 Analyze
dimensional arrays.
10. What are the different ways of initializing array? BTL -2 Understand
11. What is the use of ‘\0’ and ‘%s’? BTL -1 Remember
12. Is address operator used in scanf() statement to read an
array? Why? BTL -6 Create
13. What is the role of strrev()? BTL -3 Apply
14. Show a C function to compare two strings. BTL -3 Apply
15. How to initialize a string? Give an example. BTL -6 Create
16. What will be the output of following program ?
#include <stdio.h>
int main()
{
BTL -2 Understand
char str[8]="IncludeHelp";
printf("%s",str);
return 0;
}
17. Write the output of the following Code:
main()
{
char x; x = ‘a’; BTL -5 Evaluate
printf(“%d \n”,x);
}
18. Specify any two applications of Array. BTL -5 Evaluate
19. List out the any four functions that are performed on BTL -1 Remember
character strings.
20. Write the output of the following Code:
main()
{
static char name[]=”KagzWrxAd”;
int i=0;
while(name[i]!=’\0’) BTL -2 Understand
{
printf(“%c”,name[i]);
i++;
}
}
PART -B
1. (i) Explain the need for array variables. Describe the
following with respect to arrays. Declaration of array
and accessing an array element. (6) BTL -1 Remember
(ii) Write a C program to re-order a one-dimensional
array of numbers in descending order. (7)
2. Write a C program to multiply two matrices (two-
dimensional array) which will be entered by a user. The
user will enter the order of a matrix and then its elements
and similarly input the second matrix. If the entered BTL -4 Analyze
orders of two matrices are such that they can’t be
multiplied by each other, then an error message is
displayed on the screen.(13)
3. Write a C program to calculate median for an array of
BTL -5 Evaluate
elements.(13)
4. Write a C program for Determinant of a matrix.(13) BTL -4 Analyze
5. Describe the following with suitable examples. (6+7)
(i) Initializing a 2 Dimensional Array
(ii) Memory Map of a Dimensional Array. BTL -2 Understand
6. Write a C program for transpose of a matrix.(13) BTL -1 Remember
7. Discuss about the runtime initialization of a two BTL -1 Remember
dimensional array.(13)
8. Write a C program to sort the n numbers using selection
sort. (13) BTL -2 Understand
9. Develop a C program to search an element from the array.
(13) BTL -6 Create
10. Explain about the String Arrays and its manipulation in
BTL -1 Remember
detail (13)
11. Write a C program to find whether the given string is
palindrome or not without using string functions. (13) BTL -3 Apply
12. (i) What are the different types of string function?
Describe with their purpose.(5)
(ii) Write the C program to find the number of Vowels, BTL -2 Understand
Constants, Digits and white space in a string. (8)
13. Illustrate with an example of command line arguments.
BTL -3 Apply
(13)
14. Explain about the following :
(i).String and character array.(4)
(ii).Initializing a string variables.(4) BTL -4 Analyze
(iii).String input and output (5)
PART-C
Write a C program to find average marks obtained by a of BTL -6 Create
1. 30 students in a test.(15)
Write a C program to perform the following matrix BTL -6 Create
2. operations: (i)Addition(4) (ii) subtraction (4)
(iii)multiplication (7)
3. (i) Write a C program to strcpy function.(7) BTL -5 Evaluate
(ii) Compare and contrast gets() and puts().(8)
Write a C program to Check whether a given number is BTL -5 Evaluate
4.
Armstrong number or not using command line
argument.(15)
SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203.
DEPARTMENT OF GENERAL ENGINEERING
QUESTION BANK
SUBJECT : Programming in C
SEM / YEAR : Second Semester / 1st Year
UNIT III-FUNCTIONS
SYLLABUS
Introduction to functions: Classification of functions- function definition-function call-
function with inputs and outputs-recursive function-library functions-scope of variables.
PART - A
Q.No Questions BT Level Competence
1. Define function. How will you declare it? BTL -1 Remember
2. What are the various parts of functions? BTL -1 Remember
3. Express the difference between function declaration and
function definition. BTL -2 Understand
4. What is function call? BTL -1 Remember
5. Write any two applications of recursive function. BTL -1 Remember
6. Differentiate between call by value and call reference.
BTL -4 Analyze
7. Why is scope of variable necessary in function? BTL -2 Understand
8. Write a function in C to find the square of any number. BTL -1 Remember
9. Point out the meaning of user-defined function. BTL -4 Analyze
10. What is meant by library function? BTL -4 Analyze
11. Show the difference in call by value and reference using
BTL -6 Create
a simple programming example.
12. When will be the library function used? BTL -3 Apply
13. What will be output of the following?
#include <stdio.h> BTL -3 Apply
int incr(int i)
{ static int count = 0;
count = count + i;
printf("count=%d\n",count);
}
void main()
{
int i,j;
for (i = 0; i <=4; i++)
j = incr(i);
}
14. Invent the output of the following code: BTL -6 Create
#include<stdio.h>
int A=2;
int B=3;
int Add()
{
return A + B;
}
int main()
{ int answer;
A = 5;
B = 7;
answer = Add();
printf("%d\n",answer);
return 0;
}
15. What is a recursive function? BTL -2 Understand
16. Specify the need for function. BTL -5 Evaluate
17. Point out the error in the program BTL -5 Evaluate
#include<stdio.h>
int main()
{ int a=10;
void f();
a = f();
printf("%d\n", a);
return 0;
}
void f()
{
printf("a");
}
18. What is no argument and no return value in a function? BTL -1 Remember
19. Narrate how to apply user-defined function. BTL -3 Apply
20. Mention the advantage of pass by reference. BTL -2 Understand
PART – B
1. Describe about user defined function and predefined Remember
BTL -1
function with an example.(13)
2. Write a code in C to get the largest element of an array
BTL -4 Analyze
using function. Analyze the code with sample input
25,5,8,89 and 70.(13)
3. Apply a recursive function in C for reverse a sentence. BTL -3 Apply
(13)
4. Discuss about the classification of functions depending BTL -2 Understand
upon their inputs and output (parameters).(13)
5. Explain in detail about Pass by Value and Pass by BTL -1 Remember
reference. (13)
6. Discuss about passing arrays to function. (13) BTL -2 Understand
7. Explain in detail about recursive function with sample Evaluate
BTL -5
code. (13)
8. Analyze with example code in C for global and local BTL -4 Analyze
variables . (13)
9. Write notes on fixed argument functions and variable BTL -1 Remember
argument functions. (13)
10. Write the C program to find the value of sin(x) using the BTL -3 Apply
series up to the given accuracy (without using user
defined function) also print sin(x) using library function.
(13)
11. Write a C program for Scientific calculator using built-in
BTL -4 Analyze
functions(13)
12. Write the C coding for swapping of two numbers using
pass by reference.(13) BTL -1 Remember
13. Write a C program to sort the given N names using BTL -2 Understand
function. (13)
14. Explain about any 4 library functions in c. (13) BTL -6 Create
PART-C
1. Develop a C program for binary search using recursive
BTL -6 Create
function.(15)
2. Examine with example program to display all prime
BTL -5 Evaluate
numbers between two intervals using functions. (15)
3. Develop a C program for towers of Hanoi using recursive BTL -6 Create
function.(15)
4. Illustrate a C program for cube of a number using pass by
reference.(15) BTL -5 Evaluate
SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203.
DEPARTMENT OF GENERAL ENGINEERING
QUESTION BANK
SUBJECT : Programming in C
SEM / YEAR : Second Semester / 1st Year
UNIT-IV- STRUCTURES AND UNIONS
SYLLABUS
Introduction to Structures :Array of structures – Nested structure-functions and
Structures-Introduction to union-:practical applications of union ––typedef and
structures-enumerated data type.
PART – A
Q.No Questions BT Level Competence
1. What is structure? Write the syntax for structure. BTL -1 Remember
2. Where is Union used in C? BTL -1 Remember
3. How the members of structure object is accessed? BTL -2 Understand
4. How many bytes in memory taken by the following C BTL -1 Remember
structure?
#include <stdio.h>
struct test
{ int k;
char c;
};
5. What is a nested structure? BTL -1 Remember
6. How typedef is used in structure? BTL -4 Analyze
7. Interpret the term Union in C. BTL -2 Understand
8. What is meant by Self-referential structures? BTL -1 Remember
9. Point out the meaning of array of structures.
BTL -4 Analyze
10. Can we compare two structures in C? Justify. BTL -4 Analyze
11. Specify the use of typedef. BTL -3 Apply
12. Can Union be nested in structure?
BTL -6 Create
13. Discover the meaning of enum. BTL -3 Apply
14. Show the difference between Structures from Array. BTL -3 Apply
15. Invent the application of size of operator to this structure.
Consider the declaration:
struct
{
BTL -6 Create
char name;
int num;
} student;
16. Is it mandatory that the size of all elements in a union
BTL -2 Understand
should be same?
17. Develop a structure namely Book and create array of Book
structure with size of ten. BTL -5 Evaluate
18. What will be the output of the C program?
#include<stdio.h> BTL -5 Evaluate
int main()
{ enum numbers{n1 = 1.5, n2 = 0, n3, n4, n5, n6};
printf("%d %d\n", n1, n2);
}
19. What is the difference between enum and macro?
BTL -1 Remember
20 Can we declare function inside structure of C BTL -2 Understand
programming? Justify.
PART – B
1. Describe about the functions and structures. (13) BTL -1 Remember
2. Explain about the structures and its operations. (13) BTL -2 Understand
3. Explain about array of structures and nested structures
with example.(13) BTL -3 Apply
4. Write a C program using structures to prepare the
students mark statement. (13) BTL -2 Understand
5. Write a C program to add two distances in feet and
inches using structure (13) BTL -2 Understand
6. Write a C program to read the details of book name,
author name and price of 200 books in a library and
display the total cost of the books and the book details BTL -1 Remember
whose price is above Rs.500. (13)
7. (i) Express a structure with data members of various
types and declare two structure variables. Write a
program to read data into these and print the same. (8) BTL -3 Apply
(ii) Justify the need for structured data type.(5)
8. (i) Does structure bring additional overhead to a
program? Justify. (7) BTL -1 Remember
(ii)Write short note on structure declaration.(6)
9. (i).How to access enumerated datatype and explain with
an example program.(7)
(ii) Create enum of week days. Write a program in C, use BTL -6 Create
this enum and display it. (6)
10. Explain with an example the self-referential structure. (13)
BTL -4 Analyze
11. Explain nested structure and write C Program to BTL -5 Evaluate
Implement the same. (13)
12. Compare with example code for Structure and BTL -4 Analyze
Union.(13)
13. Illustrate a C program to store the employee information BTL -1 Remember
using structure and search a particular employee
details.(13)
14. Define a structure called student that would contain
name, regno and marks of five subjects and percentage.
Write a program to read the details of name, regno and
marks of five subjects for 30 students, calculate the
BTL -4 Analyze
percentage and display the name, regno, marks of the
subjects and percentage of each student(13)
PART-C
1 Write a structure to store the name, account number and BTL -6 Create
balance of customers (more than 10) and store their
information. Write a function to print the names of all the
customers having balance less than $200.(15)
Write a C program using structures to prepare the BTL -5 Evaluate
2
employee pay roll of a company. (15)
Examine the differences between nested structures and
3 array of structures.(15) BTL -5 Evaluate
Develop a C Program to use the arrays inside union BTL -6 Create
4 variables.(15)
SRM VALLIAMMAI ENGINEERING COLLEGE
SRM Nagar, Kattankulathur – 603 203.
DEPARTMENT OF GENERAL ENGINEERING
QUESTION BANK
SUBJECT : Programming in C
SEM / YEAR : Second Semester / 1st Year
UNIT-V- STORAGE CLASS AND PREPROCESSOR DIRECTIVE
SYLLABUS
Introduction to storage classes: Types of storage classes- C preprocessor Directives:
Types of preprocessor directives-Pragma Directive-conditional directive.
PART – A
Q.No Questions BT Level Competence
1. Define storage class specifier. BTL -1 Remember
2. Mention different type of storage classes. BTL -1 Remember
3. Distinguish between auto and register. BTL -2 Understand
4. What is meant by extern? Give an example. BTL -1 Remember
5. What is storage class for variable A in below code?Justify. BTL -1 Remember
int main()
{ int A;
A = 10;
printf("%d", A);
return 0;
}
6. What will the SWAP macro in the following program be BTL -4 Analyze
expanded to on preprocessing? will the code compile?
#include<stdio.h>
#define SWAP(a, b, c)(c t; t=a, a=b, b=t)
int main()
{ int x=10, y=20;
SWAP(x, y, int);
printf("%d %d\n", x, y);
return 0;
}
7. How are preprocessor directives written in C? BTL -6 Create
8. How can you avoid including a header more than once? BTL -1 Remember
9. How to pragma directive works? BTL -4 Analyze
10. Compare the pragma and conditional directive. BTL -4 Analyze
11. Examine the six pragma directives.
BTL -3 Apply
12. Write the syntax of pragma directive. BTL -2 Understand
13. Is there any difference that arises if double quotes , instead BTL -3 Apply
of angular brackets are used for including the standard
header file?
14. Identify the use of pragma directive in c. BTL -3 Apply
15. List out the seven conditional directives in c. BTL -1 Remember
16. What is the use of #if directive? BTL -2 Understand
17. Write a note on define macro. BTL -5 Evaluate
18. Evaluate the advantages of a macro over a function. BTL -5 Evaluate
19. Develop an example for conditional compilation. BTL -6 Create
20 What does #undef, #pragma indicate in c? BTL -2 Understand
PART – B
1. Describe about the various storage classes with example BTL -2 Understand
program.(13)
2. Distinguish between the following macro.
(i)object like macro(7) BTL -2 Understand
(ii)function like macro(6).
3. Illustrate and explain about unconditional preprocessor
directive.(13) BTL -3 Apply
4. Explain about #if, #else ,#elif directive with an example
program.(13) BTL -2 Understand
5. Describe the defined operator and #error directive .(13) BTL -1 Remember
6. Define a macro in C to check whether a given three-digit
number is an Armstrong number or odd. Illustrate the use BTL -1 Remember
of this macro in a program. (13)
7. Write about conditional preprocessor directive with an
example.(13) BTL -3 Apply
8. Define a macro in C to check whether a given number is
even or odd. Illustrate the use of this macro in a program. BTL -1 Remember
(13)
9. Write about all the pragma directive and explain in
detail.(13) BTL -6 Create
10. Write the C coding for finding the average of number Analyze
using any of the storage class declarations.(13) BTL -4
11. Explain the various ways in which a source file inclusion BTL -5 Evaluate
directive can be written.(13)
12. Examine the various stages a program undergoes before BTL -4 Analyze
execution.(13)
13. Write a C Program to calculate the factorial of a number BTL -1 Remember
by using the keyword static.(13)
14. Write a C Program to generate Fibonacci series by using BTL -4 Analyze
keyword auto.(13)
PART-C
1 Write any two common macro pitfalls with example BTL -6 Create
program.(15)
2 Write preprocessor directives code in C for roots of a
BTL -5 Evaluate
quadratic equation. (15)
3 Develop a C Program based on conditional directive to BTL -6 Create
display the Distinction, First class and Second class
based on the student mark is above 70, between 60 to 70
and between 40 to 60 respectively otherwise Fail. (15)
4 Summarize of storage classes with respect to various
parameters storage location, initial value, lifetime and BTL -5 Evaluate
linkage .(15)