Programming in C QB
Programming in C QB
QUESTION BANK
II SEMESTER
CS3251 PROGRAMMING IN C
Regulation – 2021
Prepared by
QUESTION BANK
6. List the various keywords used to write pseudo code. RBTL -1 Remember CO1
14. Analyze Increment and Decrement Operators with an RBTL - 4 Analyze CO1
example.
15. Generalize the types of I/O statements available in ‘C’. RBTL -6 Create CO1
16. Show the differences between while and do-while RBTL -3 Apply CO1
statements.
17. Differentiate the switch and nested-if statement. RBTL -2 Understand CO1
18. Invent what type of loop and how?
#include <stdio.h> RBTL -5 Evaluate CO1
int main () {
for(; ; ) {
printf("This loop will run forever.\n");
}
return 0;
}
19. Show the general form of if – else – if statement. RBTL -3 Apply CO1
20. Describe the order of precedence of operators. RBTL - 3 Apply CO1
21. Analyze the significance of Sizeof operator. RBTL - 4 Analyze CO1
22. Write a program to determine whether a person is eligible
RBTL -5 Evaluate CO1
to vote.
23. Provide the significance of break statement in loops. RBTL -2 Understand CO1
24. Discuss the compilation process RBTL -2 Understand CO1
PART - B.
1. (i). Explain the characteristics and need of an algorithm. CO1
(ii). Write an algorithm to find the first N natural RBTL -1 Remember
numbers. (6 + 7)
PART-C
Develop a C program for the following: CO1
(i) To check whether a number is prime or not. (8)
1. (ii). To convert the temperature given in Fahrenheit to RBTL - Create
6
Celsius and vice versa. (7)
Compare and contrast branching and looping statements CO1
2. used in C. (15) RBTL - Evaluate
5
Develop a C Program to find the power of a Number RBTL - Create CO1
3. Using the while loop and using pow () function. (15) 6
Develop a menu driven program in C to perform various RBTL - Create CO1
4. 6
arithmetic operations. (15)
Summarize the algorithm, flowchart and pseudo code
5. with an example. (15) RBTL - Evaluate CO1
5
UNIT II - ARRAYS AND STRINGS
SYLLABUS
Introduction to Arrays: Declaration, Initialization – One dimensional array –Two dimensional
arrays - String operations: length, compare, concatenate, copy – Selection sort, linear and
binary search
PART - A
Q.No Questions BT Level Competence Course
OutcomeS
1. What is an array? Write the syntax for array. RBTL -1 Remember CO2
2. Define a float array of size 5 and assign 5 values to it. RBTL -1 Remember CO2
3. Why are arrays needed? RBTL -4 Analyze CO2
3. Apply recursive function in C for reverse a sentence. (13) RBTL - Apply CO3
3
Discuss about the classification of functions depending RBTL - Understand CO3
4. upon their inputs and output (parameters). (13) 2
Explain in detail about Pass by Value and Pass by RBTL - Remember CO3
5. reference. (13) 1
SYLLABUS
Structure - Nested structures – Pointer and Structures – Array of structures – Self
referential structures – Dynamic memory allocation - Singly linked list – typedef – Union
- Storage classes and Visibility
PART – A
Q.No Questions RBT Level Competence Course
Outco
mes
1. What is structure? RBTL -1 Remember CO4
2. Where is Union used in C? RBTL -1 Remember CO4
3. How the members of structure object is accessed? RBTL -2 Understand CO4
4. How many bytes in memory taken by the following C RBTL -1 Remember CO4
structure?
#include <stdio.h>
struct test
{ int k;
char c;
};
5. What is a nested structure? RBTL -1 Remember CO4
6. How typedef is used in structure? RBTL -4 Analyze CO4
7. Define the term Union in C. RBTL -2 Understand CO4
8. What is the output of the following program? RBTL -1 Remember CO4
#include<stdio.h>
void main ( )
{
enum days {MON=-1, TUE, WED=4, THU,FRI,SAT};
printf("%d, %d, %d, %d, %d, %d", MON, TUE, WED,
THU, FRI, SAT);
}
9. Point out the meaning of array of structures.
RBTL -4 Analyze CO4
10. Examine the output of the following program: RBTL -4 Analyze CO4
#include<stdio.h>
void main ( )
{
enum status {pass, fail, absent};
enum status stud1, stud2, stud3; CO4
stud1 = pass;
stud2 = absent;
stud3 = fail;
printf("%d %d %d\n", stud1, stud2, stud3);
}
11. Specify the use of typedef. RBTL -3 Apply CO
4
12. Determine the output of the following program:
#include<stdio.h> RBTL -6 Create CO
void main () 4
{
union a
{
int i;
char ch[2];
};
union a u;
u.ch[0]=3;
u.ch[1]=2;
printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i);
}
13. Discover the meaning of enum. RBTL -3 Apply CO
4
14. Differentiate Structures with Arrays. RBTL -3 Apply CO
4
15. Invent the application of size of operator to this structure. CO4
Consider the declaration:
struct
{
char name; RBTL -6 Create
int num;
}student;
16. How the structure members are initialized? RBTL -2 Understand CO
4
17. Differentiate between structure and a union. RBTL -3 Apply CO
4
18. How members of a union are accessed? RBTL -4 Analyze CO
4
19. What do you mean by self – referential structure? CO4
RBTL -5 Evaluate
20. Is it mandatory that the size of all elements in a union
should be same? RBTL -2 Understand CO
4
21. Develop a structure namely Book and create array of Book CO4
structure with size 10. RBTL -5 Evaluate
22. What will be the output of the C program? CO4
#include<stdio.h> RBTL -5 Evaluate
int main ()
{
enum numbers {n1 = 1.5, n2 = 0, n3, n4, n5, n6};
printf("%d %d\n", n1, n2);
}
23. What is the difference between enum and macro?
RBTL -1 Remember CO
4
1. Describe about the functions and structures. (13) RBTL - Remembe CO4
1 r
2. Explain about the structures and its operations. (13) RBTL - Understan CO4
2 d
3. Examine the differences between nested structures and CO4
array of structures. (13) RBTL - Apply
3
4. Write a C program using structures to prepare the CO4
students mark statement. (13) RBTL - Understan
2 d
Write a C program to enter two points and then calculate CO4
5. the distance between them. (13) RBTL - Understan
2 d
Write a C program to read the details of book name, CO4
author name and price of 200 books in a library and
6. display the total cost of the books and the book details RBTL - Remembe
whose price is above Rs.500. (13) 1 r
PART-C
Write a structure to store the name, account number and RBTL - Create CO4
balance of customers (more than 10) and store their 6
1 information. Write a function to print the names of all the
customers having balance less than Rs.200.
(15)
Write a C program using structures to prepare the RBTL - Evaluate CO4
2 employee pay roll of a company. (15) 5
Write a program to read and display the information of all
3. the students in a class using array of structures. RBTL - Evaluate CO4
5
Write a C program for passing structures as function
arguments and returning a structure from a function. (15) RBTL - Evaluate CO4
4.
5
Develop a C Program to use the arrays inside union RBTL - Create CO4
5. variables. (15) 6
UNIT-V
FILE PROCESSING
SYLLABUS
Files – Types of file processing: Sequential access, Random access – Sequential
access file - Random access file - Command line arguments.
PART – A
Q.No Questions RBT Level Competence Course
Outcomes
1. Define storage class. RBTL -1 Remember CO5
2. Mention the different types of storage classes. RBTL -1 Remember CO5
3. Distinguish between auto and register storage RBTL -2 Understand CO5
class variables.
4. How static variables differ with auto variables? RBTL -3 Apply CO5
5. Write a simple program for static variable. RBTL -4 Analyze CO5
6. What will be the answer for the following RBTL -5 Evaluate CO5
code:#include<stdio.h>
int a;
int main( )
{
printf(“a = :
%d”, a)return
0;
}
7. Where the storage class variables stored? RBTL -2 Understand CO5
8. What is meant by extern variable? Give an example. RBTL -1 Remember CO5
9. What is storage class for variable A in below RBTL -1 Remember CO5
code?Justify.
int main ()
{
in
t
A;
A
=
10
;
printf("%d
", A);
return 0;
}
10. What will the SWAP macro in the following program be RBTL -4 Analyze CO5
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;
}
12. How can you avoid including a header more than once? RBTL -1 Remember CO5
13. What are the types of C preprocessor Directives? RBTL -4 Analyze CO5
14.. Compare the pragma and conditional directive. RBTL -4 Analyze CO5
22. Evaluate the advantages of a macro over a function. RBTL -5 Evaluate CO5
13. File inclusion can be nested. Justify this statement with CO5
the help of a suitable example. (13) RBTL - Apply
3
14. Comment on the restrictions imposed on the conditional RBTL - Understand CO5
expression of #if directive. (13) 2
15. (i). What do you understand by the term preprocessor RBTL - Evaluate CO5
directive? (7) 5
(ii). Can we have a C program that does not use any
preprocessor directive? (6)
16. Write a C Program to calculate the factorial of a number RBTL - Remember CO5
by using the keyword static. (13) 1
17. Write a C Program to generate Fibonacci series by using RBTL -4 Analyze CO5
keyword auto. (13)
PART-C
Describe all storage class variables with programming RBTL -6 Create CO5
1 examples.
Write preprocessor directives code in C for roots of a
2 quadratic equation. (15) RBTL -5 Evaluate CO5