UNIT I : FUNCTIONS & STRINGS FUNCTIONS : Functions give organization to a body.

They split a mass into convenient departments and assign duties to each. That results not only in increased efficiency but also in neater and clearer presentations. Functions compartmentalize duties, reducing chaos and confusion. The extent of their reach and their fascinating utility will unfold as we go along. Suffice it to say, that with C and functions, you can build a bridge to the sky. STRINGS : Strings – which are simply put as a special kind of array. 1) Write a C program to input a string and a character and check if that character is present in the string or not. 2) Write a C program to count the number of vowels, blanks and consonants in a given text. 3) Write a C program to reverse all strings stored in an array. 4) Explain the following string handling functions: a) strcat() b) strcpy() c) strcmp() d) strlen() 5) Write a C program to replace a substring of a given string by another substring of length less than or equal to the length of existing substring. 6) Write a C program to find the standard deviation of n numbers using functions. 7) Show two different methods of initializing character array vowel with the string of vowels “AEIOU”. 8) Write a program that inputs a line of text with function gets into char array s[100]. Output the line in uppercase letters and in lowercase letters. 9) Define functions. Explain the need of a function with an example. 10) Mention and explain the two types of function calls with an example. 11) Explain recursion with an example. Differentiate between recursion and iteration. 12) What is meant by a function call? From what parts of a program can a function be called? State several advantages to the use of functions. 13) What are formal arguments? What are actual arguments? What is the relationship between Formal arguments & Actual arguments? Also what is the purpose of the return statement? 14) Can a function be called from more than one place within a program? Explain the difference between a function declaration & a function definition. When is a function declaration required? Summarize the rules governing the use of return statement. 15) What is Recursion? What are its advantages? 16) A 5-digit positive integer is entered through the key board, write a function to calculate the sum of digits of the 5-digit number:

UNIT II : STRUCTURES Which mechanic is good enough who knows how to repair only one type of vehicle ? NONE. 19) Write short note on the scope. Use it in a main function to find the smallest of arrays A. The main should read n integers in to array and print the reversed list. 20) Explain the difference between actual and formal parameters with examples.i. It is an enduring entity built by the cementing of very diverse blocks. c) functions with one arguments and one return value. C and D each with 4 elements. or all floats or all chars at a time.Explain the following : a) Nested structures b) Pointer to a structure. d) functions with no arguments but return a value. 21) What do you mean by recursive function. Same thing is true about C language. Structures are edifices constructed around a number of discrete elements. 2. The function isprime() returns one if the number is prime. c) array of structures.Declare a structure which will contain the following data for 3 employees: Employee code (3 characters) First name (20 characters) Middle initial(1 character) Last namr(20 characters) . It would not have been so popular had it been able to handle only all ints. 26) Write a function that finds the smallest of 4 numbers in an array N. B. Write a C program to find GCD of two positive numbers. otherwise returns zero. Without using Recursion ii. 22) Explain with an example the following two ways of defining functions : a) Non ANSI style a) Non ANSI style b) ANSI style b) ANSI style 23) Explain with an example the following two ways of function declaration 24) Write a C program that accepts two positive integers and display all prime numbers between them. b) functions with arguments and no return values. With using Recursion 17) What is the advantage of using function prototyping within a program? 18) Explain following category of functions : a) functions with no arguments and no return values. 1. visibility and lifetime of a variable. 25) Write a function which reverses a list of n integers stored in an array passed to it.

emp_name. 6) Define structure. 16) Write a C program to create a structure named as employee to contain empno. Give an example. 2) How storage area is shared by union members. Accept the details and display the same by adding Rs. deletion and updation of the student record. The program should input the value from the user and call function reverse bits to . 7) Write a c program to define a structure with a data member’s emp_id. 9) Write a program that reverses the order of the bits in an unsigned integer value.and print out the initials of each along with their code(eg. team name. salary. 4. 6) What are unions how do they differ from structures? 7) What do you mean by enumerated data types explain with an example? 8) Briefly explain the bit fields and the reasons for using it. 11) What is a Structure? How does a Structure differ from an Array? What is a member? What is the relationship between a member & a structure? 12) How is an array of structures initiated ? How is a structure member accessed? How can a structure member be processed? 13) What is the purpose of the typedef feature? How is this feature used in conjunction with structures? 14) What are the uses of structures? Write a sample program for accessing structure elements and to demonstrate how structure elements are stored 15) Write a complete C program that will accept the following information for each team in baseball league. Create a menu to implement insertion. 5. Distinguish between an array and a structure. Using cricket declare an array player with 10 elements and write a program to read the information about all the 10 players and print a team wise list containing names of players with their batting average. Write a C program to create record of countries and capitals using structures. name and basic pay. UNIT III : UNIONS 1) Explain the concept of Union with an example. Write a C program to read employee records using array of pointers to structures and display them. 3) How is a union initialized? 4) How can a union member be accessed? 5) Write a program that has union whose member variables related to employee code.Anil K Nehra would be printed as AKN) 3.E02 andE03. 1000 to the basic pay. 9) Is it possible to define nested structures? Justify the answer.Write a C program to input names for all 3 employees . 10) What is the difference between arrays and structures? Explain. Explain the initialization of structures with an example. batting average called cricket. a) Team name including the city b) No. Define functions names as accept to accept the details and display for displaying the same 17) Define a structure called cricket that will describe the following information: player name. 8) With an example explain the operators used to access members of structures. of wins c) Number of losses.The employee codes to be stored in this structure are E01. The program accepts the values of all the member variables and displays them. Compare it with that of a structure. name and designation.

7) Write a program to show the use of pointers to pass arguments to function by reference. . 3) Write a program that defines and uses macro PRINT to print a string value. Print the value in bits both before and after the bits are reversed to confirm that the bits are reversed properly. array names may be manipulated in precisely the same manner as pointers. 10) Write a program that right shifts an integer variable 4 bits. Does your system place 0’s and 1’s in the vacated bits? UNIT IV : POINTERS 1) Explain the concept of pointers with an example. 9) what is the advantages and disadvantages of pointers. 19) Write a program using pointers to compute the sum of all elements stored in an array. 4) Write a C program to exchange the position of strings in an array using an array of pointers. The program should print the integer in bits before and after the shift operation. 8) State whether the following are true or false. 17) Explain the following operations on pointers : a) assignment b) addition and subtraction c) comparison 18) Explain with an example the difference between two dimensional array of characters and array of pointers to strings. If false. 11) What is the purpose of Indirection operator? To what type of operand must the indirection operator be applied? 12) How is pointer variable declared? What the purpose of the data type included in the declaration? 13) What is the relationship between an array name and a pointer? How is an array name interpreted when it appears as an argument to a function? 14) How is the library function malloc( ) used to associate a block of memory with a pointer variable? How is the size of the memory block specified? What kind of information does malloc( ) function return? 15) Write a program to re order a one – dimensional integer array from smallest to largest version using printer notation. Input the values from the keyboard. 10) Explain pointers to function and pointers structures. 5) Write a C program to search for a given character in a string and print the string from start to the point of match. B) Because the name of an array is a pointer to the first element of the array. 16) Explain with an examples difference between call by value and call by reference. A) two pointers that point to different arrays cannot be compared meaningfully. The program should define macro SUM with two arguments x and y and use SUM to produce the output. UNIT V : PREPROCESSORS & ADVANCED C 1) Write a program that produces the following output : THE SUM OF X AND Y IS 13. explain why. 6) what is a pointer? How it is defined and initialized? Explain with an example. 2) Write a program that defines and uses macro MIIMUM to determine the smallest of two numeric values. 2) Write a C program to perform Bubble Sort using pointers. 3) Write a note on Functions returning pointers.print the bit in reverse order.

(3). and call the macro definitions for calculating area and perimeter for different squares. a square and a circle. k=PRODUCT (++i). To test whether a character is an alphabet or not. j. 8) Differentiate between the functions exit and at exit with an programming example. k). j=PRODUCT (i++). Include this file in your program. b). Make use of the macros you defined in (1) and (2) above. reads the characters from the first file one at a time and writes the characters in reverse order to the second file. k. triangles and circles. printf (“\n%d%d”. 11) Write a descriptive note on features of a ‘C’ Preprocessor.4) Program to illustrate the use of command line arguments. 9) Write a program that takes two command line arguments that are file names. j. #ifdef DEF i*=i.h”. (4). 14) What will be the output of the following program: (a) main () { int i = 2. 6) What do you mean by a preprocessor directive? List and explain. j=PRODUCT (i+1). } (c) #define PRODUCT(x) (x*x) main ( ) { int i=3.j. a message from compiler to the programmer . Store these macro definitions in a file called “areaperi. Explain in detail. Write down macro definition for the following: (1).j). (2). printf (“\n%d”. To test whether a character entered is a small case letter or not.i). 13) Attempt the following: a). #else printf (“\n%d”. 7) Explain command line arguments with example. Write macro definitions with arguments for calculation of area and perimeter of a triangle. 5) Program to illustrate the program termination with exit and atexit. 10) Briefly explain the structured programming concepts. #endif } (b) # define PRODUCT(X) (x*x) main ( ) { int i=3. What are the several step involved from stage of writing a ‘C’ program to the stage of getting it executed? 12) Macros Vs Functions. To test whether a character entered is a upper case letter or not. } 15) Answer the following: (a) What is a preprocessor directive? 1. To obtain the bigger of two numbers.

A file that contains standard library functions 2.h> (f) A header file is: 1. A file that contains definitions and macros 3. A file that contains user – defined functions 4. 4. 3) After preprocessing when the program is sent for compilation the macros are removed from the expanded source code. 2) A macro should always be accommodated in a single line. A file that is present in current working directory. 3.2. a message from compiler to the linker a message from programmer to the preprocessor a message from programmer to the microprocessor (b) Which of the following are correctly formed #define statements: #define #define #define #define INCH PER FEET 12 SQR (X) (X*X) SQR (X) X*X SQR (X) (X*X) (c) State True or False: 1) A macro must always be written in capital letters. . (d) How many #include directives can be there in a given program file? (e) What is the difference between the following two #include directives: #include “conio.h” #include <conio.

Sign up to vote on this title
UsefulNot useful