Ocs752 Introduction To C Programming

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

lOMoARcPSD|28265006

OCS752-Introduction to C Programming

computer science (Anna University)

Studocu is not sponsored or endorsed by any college or university


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com

SRM VALLIAMMAI ENGINEERING COLLEGE


(An Autonomous Institution)
SRM Nagar, Kattankulathur – 603 203

DEPARTMENT OF INFORMATION TECHNOLOGY

QUESTION BANK

VII SEMESTER
OCS752 – INTRODUCTION TO C PROGRAMMING
Regulation – 2017

Academic Year 2020 – 2021(odd Semester)

Prepared by

Ms. S. Shenbagavadivu, Assistant Professor (Sr.G)/IT


Mr. M. Kavinkumar, Assistant Professor (Sr.G)/IT

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com

SRM VALLIAMMAI ENGINEERING COLLEGE


SRM Nagar, Kattankulathur-603203
DEPARTMENT OF INFORMATION TECHNOLOGY
QUESTION BANK

SUBJECT : OCS752 – INTRODUCTION TO C PROGRAMMING


SEM / YEAR : VII SEMESTER/ FINAL YEAR (CIVIL, ECE, EEE, EIE)
UNIT -I INTRODUCTION
Structure of C program – Basics: Data Types – Constants –Variables - Keywords – Operators: Precedence
and Associativity - Expressions - Input/output statements, Assignment statements – Decision-making
statements - Switch statement - Looping statements – Pre-processor directives - Compilation process –
Exercise Programs: Check whether the required amount can be withdrawn based on the available amount –
Menu-driven program to find the area of different shapes – Find the sum of even numbers
PART – A
Q. BT
Questions Competence
No. Level
1 Define Constants in C. Mention the Types. BTL1 Remembering
2 List the different data types available in C? BTL1 Remembering
3 What are Keywords? BTL1 Remembering
4 What do you mean by variables in „C‟? BTL1 Remembering
5 What is the use of sizeof() operator in C. BTL1 Remembering
6 Define Looping in C. BTL1 Remembering
7 Why header files are included in „C‟ programming? BTL2 Understanding
8 Outline delimiters in „C‟ BTL2 Understanding
9 What is type casting? BTL2 Understanding
10 What is the difference between ++a and a++? BTL2 Understanding
11 Difference between Local and Global variable in C. BTL3 Applying
12 What is the difference between scanf() and gets() function? BTL3 Applying
13 What is the difference between „=‟ and „==‟ operator? BTL3 Applying
14 What are the types of I/O statements available in „C‟? There are two
BTL4 Analyzing
types of I/O statements available in „C‟.
15 What are Operators? Mention their types in C BTL4 Analyzing
16 Mention the various Decisions making statement available in C. BTL4 Analyzing
17 What do you meant by conditional or ternary operator? BTL5 Evaluating
18 What is the difference between if and while statement? BTL5 Evaluating
19 What are the types of looping statements available in C BTL6 Creating
20 Distinguish between while..do and do..while statement in C BTL6 Creating
PART – B
1 Describe the structure of C program with example?(13) BTL1 Remembering
2 What is data type? Explain different types of data types in detail with
BTL1 Remembering
example.(13)
3 Describe the various types of operators in „C‟ language along with its BTL1 Remembering
priority.(13)
4 What is loop? Explain its types in detail with example.(13) BTL1 Remembering

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
5 i)Discuss nested loop structure with suitable example.(6)
BTL2 Understanding
ii) Summarize the input and output function in „C‟(7)
6 Discuss in detail about „C‟ declarations and variables(13) BTL2 Understanding
7 Illustrate in detail about the constants, expressions and statements in BTL2 Understanding
„C‟(13)
8 Apply the various decision making statements in a single „C‟ program BTL3 Applying
(13)
9 Identify the following terms and explain it:
i. Keywords (3)
ii. Identifiers (3) BTL3 Applying
iii. C character set (3)
iv. Constant and Volatile variables(4)
10 Build a C program for numbers from 1 to n.
i. To find the sum (6) BTL3 Applying
ii. To find prime numbers(7)
11 Explain the following:
i. break statement with example program (5)
BTL4 Analyzing
ii. continue statement with example program(4)
iii. goto statement with example program(4)
12 How switch case will work explain it with one example?(13) BTL4 Analyzing
13 Evaluate a C program to find whether a given number is palindrome or
BTL5 Evaluating
not(13)
14 i. Create a C Program to perform swapping of two numbers(6)
BTL6 Creating
ii. Create a C program to find the sum of even numbers(7)
PART – C
1 Construct a C program with a following operators in a C language?
a. Bitwise Operators (5)
BTL6 Creating
b. Logical operator(5)
c. Increment and decrement operator.(5)
2 Create a C program to perform various calculator arithmetic operations
BTL6 Creating
using switch statement.(15)
3 Write a Menu driven program in C to find the area of different
BTL5 Evaluating
shapes.(15)
4 Assess a C program to check whether given amount can be withdrawn
BTL5 Evaluating
from the given bank account or not?(15)

UNIT II ARRAYS
Introduction to Arrays – One dimensional arrays: Declaration – Initialization - Accessing elements –
Operations: Traversal, Insertion, Deletion, Searching - Two dimensional arrays: Declaration – Initialization
- Accessing elements – Operations: Read – Print – Sum – Transpose – Exercise Programs: Print the number
of positive and negative values present in the array – Sort the numbers using bubble sort - Find whether the
given is matrix is diagonal or not.
PART – A
Q. BT
Questions Competence
No. Level
1 Define Array. BTL1 Remembering
2 List out the classifications of an array? BTL1 Remembering
3 What is an array variable? How does it differ from an ordinary
BTL1 Remembering
variable?
4 Define bubble sort. BTL1 Remembering
5 Give the syntax of an array in C BTL1 Remembering

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
6 List any four features of array BTL1 Remembering
7 What are the conditions that must be satisfied by all the elements of any
BTL2 Understanding
given array?
8 What is meant by sorting? BTL2 Understanding
9 In what manner you will access the elements in an array? BTL2 Understanding
10 Outline the characteristics of an array? BTL2 Understanding
11 Say the procedure to find whether the element is present in the array
BTL3 Applying
elements or not?
12 Identify how to initialize an array in C? BTL3 Applying
13 Identify the conditions that must be satisfied by all elements of any
given array? BTL3 Applying
14 How an array of 10 integers declared and used in C BTL4 Analyzing
15 How to declare and initialize 1-D, 2-D array with an example BTL4 Analyzing
16 How does C handle the values in an array internally? BTL4 Analyzing
17 Assess a C program to read and display the 2D array elements? BTL5 Evaluating
18 Why do we need to give size of an array in the array declaration BTL5 Evaluating
19 Create a C program to read and display the elements using 1-D array. BTL6 Creating
20 Create a C program to print the array elements in reverse order BTL6 Creating
PART – B
1 Define one dimensional array? Give the syntax? Explain with
BTL1 Remembering
example(13)
2 Describe in detail how to access values in an array with example(13) BTL1 Remembering
3 Describe the basic operations using array example
i. Insertion(6) BTL1 Remembering
ii. Deletion(7)
4 Define array? Write a C program to search an element from the BTL1 Remembering
array(13)
5 Discuss about the process of array initialization and declaration(13) BTL2 Understanding
6 Illustrate briefly about the two dimensional array with example(13) BTL2 Understanding
7 Discuss basic operations in two dimensional array
i. Sum and print the elements in array(6) BTL2 Understanding
ii. Transpose the elements in array(7)
8 Build a C program to find sum of given n integers using array(13) BTL3 Applying
9 Explain in detail about type of sorting the array elements. (13) BTL3 Applying
10 Build a C program to sort n given numbers using bubble sort and also
BTL3 Applying
find the number of exchanges and passes(13)
11 Write a C program to multiply two matrices. (13) BTL4 Analyzing
12 Write a C program to read in an array of „N‟ integers and print its BTL4 Analyzing
elements in reverse order. (13)
13 Is it possible to pass array elements into function arguments? Justify BTL5 Evaluating
your answer with suitable example. (13)
14 Create a C program to determine whether the given matrix is
BTL6 Creating
symmetric or not(13)
PART – C
1 Discuss how you can evaluate Mean, Median and Mode for an array
of numbers. Write a C program to evaluate Mean, Median and Mode BTL6 Creating
for an array of n numbers and explain.(15)
2 Write a C program to Print the number of positive and negative values
BTL5 Evaluating
present in the array(15)
3 Write a C program to find whether the given matrix is diagonal matrix BTL5 Evaluating

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
is diagonal or not. Justify the need for it.(15)
4 Create a C program to
i. Reorder a one dimensional array of numbers in descending
BTL6 Creating
order.(7)
ii. Find whether the given is matrix is diagonal or not.(8)

UNIT III STRINGS


Introduction to Strings - Reading and writing a string - String operations (without using built-in string
functions): Length – Compare – Concatenate – Copy – Reverse – Substring – Insertion – Indexing –
Deletion – Replacement – Array of strings – Introduction to Pointers – Pointer operators – Pointer arithmetic
- Exercise programs: To find the frequency of a character in a string - To find the number of vowels,
consonants and white spaces in a given text - Sorting the names.
PART – A
Q. BT
Questions Competence
No. Level
1 Define strings? BTL1 Remembering
2 Give the declaration for the string “COMPUTER” in C BTL1 Remembering
3 What is string constant BTL1 Remembering
4 List out the any four functions that are performed on character strings BTL1 Remembering
5 What is a pointer? give examples BTL1 Remembering
6 List the advantages of using pointers BTL1 Remembering
7 Outline the operators exclusively used with pointers BTL2 Understanding
8 Summarize pointer arithmetic BTL2 Understanding
9 What does the conversion specification %6s mean BTL2 Understanding
10 Infer null string and null character BTL2 Understanding
11 How strings are manipulated in C BTL3 Applying
12 How do you indicate where the string ends? BTL3 Applying
13 How strings are represented in C language BTL3 Applying
14 What is the difference between a C character and a C string BTL4 Analyzing
15 Differentiate P and *P BTL4 Analyzing
16 Analyze how pointer is initialized BTL4 Analyzing
17 Assess how will you calculate length of given string? BTL5 Evaluating
18 What is the output of the following program?
# include <stdio.h>
Void main()
{
Char *p; BTL5 Evaluating

P=”SRMVEC”
Printf(“%d”,*&*p);
}
19 Create a C program to get the string from the keyboard and print the
BTL6 Creating
same.
20 Create a C program to find the sum of two values using Pointer BTL6 Creating
PART – B
1 Describe the string handling functions in C(13) BTL1 Remembering
2 What is pointer? How variable will be declared to the pointer?(13) BTL1 Remembering
3 Describe how pointers are used for handling characters strings(13) BTL1 Remembering

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
4 List the expressions and its meaning using pointers(13) BTL1 Remembering
5 Discuss in detail about the reading and writing a string with example
BTL2 Understanding
program(13)
6 Illustrate in detail about array of pointer with your own example(13) BTL2 Understanding
7 Discuss in detail about the pointer operators with example(13) BTL2 Understanding
8 Explain the string functions with example program
i. strcpy() (6) BTL3 Applying
ii. strcmp() (7)
9 Build a C program to count the number of lines, words and characters BTL3 Applying
in a given text(13)
10 Build a C program using pointer to find the biggest of two given
BTL3 Applying
numbers(13)
11 Assess a C program to count the occurrence of a particular character in
BTL4 Analyzing
the given string(13)
12 Write a C program to find the sum of two values using pointer(13) BTL4 Analyzing
13 Write a C program to find number of vowels, consonants, digits and
BTL5 Evaluating
whitespace in a string.(13)
14 Create a C program
i. to find whether the given string is palindrome or not. (6) BTL6 Creating
ii. to find out the length of given string.(7)
PART – C
1 Create a C program to find whether the given string is palindrome or
BTL6 Creating
not without using string functions (15)
2 Create a C program find the sorting of the names.(!5) BTL6 Creating
3 Assess in detail about various pointer arithmetic operations in detail(15) BTL5 Evaluating
4 Assess the difference between *, & and -> operators in pointer? Explain
BTL5 Evaluating
each one with suitable program?(15)

UNIT IV FUNCTIONS
Introduction to Functions – Types: User-defined and built-in functions - Function prototype – Function
definition - Function call - Parameter passing: Pass by value - Pass by reference - Built-in functions (string
functions) – Recursive functions – Exercise programs: Calculate the total amount of power consumed by „n‟
devices (passing an array to a function) – Menu-driven program to count the numbers which are divisible by
3, 5 and by both (passing an array to a function) – Replace the punctuations from a given sentence by the
space character (passing an array to a function)
PART – A
Q. BT
Questions Competence
No. Level
1 What are Pre-Defined Functions? Give example BTL1 Remembering
2 Define function in C BTL1 Remembering
3 List the types of function based on return values BTL1 Remembering
4 Define recursion BTL1 Remembering
5 Give the syntax of user defined function BTL1 Remembering
6 What are static functions? What is their use? BTL1 Remembering
7 Infer the different ways of passing parameters to the functions? Which BTL2 Understanding
to use when?
8 Outline the use of the function in C? BTL2 Understanding
9 Demonstrate what is meant by recursion with example BTL2 Understanding
10 Classify the Category of Function based on argument and return type BTL2 Understanding

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
11 Identify the possibility of a problem if a valid function name such as
tolower() is being reported by the C compiler as undefined? BTL3 Applying
12 Difference between the formal argument and the actual argument BTL3 Applying
13 Difference between strcmpi() and strncmp()? BTL3 Applying
14 Does a built-in header file contains built-in function definition? BTL4 Analyzing
15 Is it possible to have a function as a parameter in another function? BTL4 Analyzing
16 Is there a built-in function in C that can be used for sorting data? BTL4 Analyzing
17 Justify whether functions are declared or defined in header files? BTL5 Evaluating
18 Can a program be compiled without main() function? BTL5 Evaluating
19 Formulate how many arguments can be passed to a function in C? BTL6 Creating
20 Write a C program to pass the arguments to the function using call by
BTL6 Creating
value
PART – B
1 i)What is a user defined function? Why it is used? (8)
BTL1 Remembering
ii)Define Recursion function?(5)
2 List the Function Prototypes and explain it with examples(13) BTL1 Remembering
3 Tell in detail how an array can be passed as a parameter in user defined BTL1 Remembering
function. Give an example program(13)
4 Recall the various types of functions supported by C. Give examples for BTL1 Remembering
each of the C functions. (13)
5 Summarize the rules that apply to a function call in C. what
relationship must be maintained between actual arguments and formal BTL2 Understanding
argument? (13)
6 Outline predefined function and user defined function with example(13) BTL2 Understanding
7 Illustrate a program to find the factorial of a number using BTL2 Understanding
recursion(13)
8 Identify the rules in regard to a function in C and Write a recursive BTL3 Applying
function to evaluate the factorial of a number n(13)
9 Build a function to reverse a given string and use it to check whether BTL3 Applying
the given string is a palindrome. (13)
10 Construct a program to sort the array of elements in ascending order
BTL3 Applying
using functions(13)
11 Distinguish the following
i)Global and local variables (6) BTL4 Analyzing
ii)Automatic and static variables(7)
12 Inspect a program to find the biggest of the given three values and use it
to find the total obtained by a student which in turn is the sum of the BTL4 Analyzing
best of three test scores and the best of three assignment scores(13)
13 Write a c program to assess the reverse() function which accepts a
BTL5 Evaluating
string and display it in reverse(13)
14 Create a C program to replace the punctuations from a given sentence
BTL6 Creating
by the space character using passing an array to a function(13)
PART – C
1 Create a C program to calculate the total amount of power consumed
BTL6 Creating
by „n‟ devices using passing an array to a function
2 Create a Menu-driven program to count the numbers which are BTL6 Creating
divisible by 3, 5 and by both using passing an array to a function
3 Assess a C program to compare two strings S1 and S2 and return the
result 0,1, -1 if (s1=s2), (s1>s2) and (s1<s2) respectively. Also write BTL5 Evaluating
the main program.
4 Assess a C program to read a matrix of order m x n and print the sum of BTL5 Evaluating

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
all elements using functions.

UNIT V STRUCTURES
Introduction to structures – Declaration – Initialization – Accessing the members – Nested Structures –
Array of Structures – Structures and functions – Passing an entire structure – Exercise programs: Compute
the age of a person using structure and functions (passing a structure to a function) – Compute the number
of days an employee came late to the office by considering his arrival time for 30 days (Use array of
structures and functions)
PART – A
Q. BT
Questions Competence
No. Level
1 What is meant by structure BTL1 Remembering
2 Define Structure match in C that contains an integer quantity called
„won‟, an integer quantity called „lost‟, a floating pont quantity called BTL1 Remembering
„percentage‟, an array of 20 characters to hold the „name‟.
3 Tell how to access a member using structure BTL1 Remembering
4 Write a brief note on typedef BTL1 Remembering
5 What is meant by sizeof() of a structure BTL1 Remembering
6 List the ways in which passing structure to function BTL1 Remembering
7 Infer the relationship between a member and a structure BTL2 Understanding
8 Demonstrate structure tag and its purpose BTL2 Understanding
9 Consider the declaration
Struct
{
char name; BTL2 Understanding
int num;
} student;
Illustrate the application of size of operator to this structure
10 Outline Dot(.) operator BTL2 Understanding
11 Identify the advantages of structure type BTL3 Applying
12 Identify in how many ways a structure within a structure is written BTL3 Applying
13 What are the differences between structures and arrays? BTL3 Applying
14 Inspect how does a structure differ from an array BTL4 Analyzing
15 Inspect self-referential structure? BTL4 Analyzing
16 Analyze how the elements of a structure can be accessed BTL4 Analyzing
17 Judge whether you can assign one structure variable to another,
BTL5 Evaluating
provided they are of same type.
18 Can we pass the address of a structure variable to a function? BTL5 Evaluating
19 Formulate a suitable declaration using structure for time BTL6 Creating
20 Write a c Program to read and display the details of a student using
BTL6 Creating
structure
PART – B
1 Discuss the method of passing structure to a function with suitable
BTL1 Remembering
function.
2 What is Structure? How is it different from an array? How they are
BTL1 Remembering
defined and initialized? Explain with examples.
3 Define and declare a structure to store date, which including day, BTL1 Remembering
month and year
4 Give an example of a C structure and explain how members of the BTL1 Remembering
structure are accessed in a C program?

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)
lOMoARcPSD|28265006

www.rejinpaul.com
5 Illustrate the structure variables and array with its initialization. Give BTL2 Understanding
example
6 Discuss how to copy and compare structure variables? Illustrate with BTL2 Understanding
example
7 Summarize
i) Dot(.) operator (6) BTL2 Understanding
ii) Sizeof() operator (7)
8 Construct a C program to read and display student details using
BTL3 Applying
structure
9 Build a C program to illustrate the concept of structure within BTL3 Applying
structure.
10 Identify the structure as a function argument with an example
BTL3 Applying
program.
11 Explain the following
i. Nested structures (6) BTL4 Analyzing
ii. Array of structures (7)
12 Distinguish between structures and arrays BTL4 Analyzing
13 Assess in detail about the self referential structures BTL5 Evaluating
14 Create 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 BTL6 Creating
appropriate method to define the above details and define a function
that will display the contents?
PART – C
1 Create a C program to compute the age of a person using structure and
BTL6 Creating
functions using passing a structure to a function
2 Assess the relationship in detail between a structure and accessing a
BTL5 Evaluating
member structure
3 Bring out the meaning of array of structures. Write a C program to
read the following information of 60 students: student name, student
BTL5 Evaluating
roll number and marks of 5 subjects. Print the roll numbers and names
of the students who have secured more than 60 percent.
4 Create a C program to compute the number of days an employee came
late to the office by considering his arrival time for 30 days Using BTL6 Creating
array of structures and functions

Download updated materials from Rejinpaul Network App


Downloaded by Jegatheeswari ic37721 (ic37721@imail.iitm.ac.in)

You might also like