Upload
j021159
View
223
Download
0
Embed Size (px)
Citation preview
UNIT I INTRODUCTION 10 hrs.Introduction: Algorithms & flowcharts-Overview of C-Features of C-IDE of C Structure of C program-Compilation& execution of C program-Identifiers, variables, expression, keywords, data types, constants, scope and life of variables,local and global variables. Operators: arithmetic, logical, relational, conditional and bitwise operators- Special operators:size of () & comma (,) operator-Precedence and associativity of operators & Type conversion in expressions.Basic input/output and library functions: Single character input/output i.e. getch(), getchar(), getche() &putchar()-Formatted input/output: printf() and scanf()-Library Functions: concepts, mathematical and character functions.
1.What is the use of “size of” operator? Give an example. 12/2013
2.What is the use of main () and print f functions? 12/20131. State the structure of C program. 05/2013 2. What is type conversion? 05/20131.Give the difference between a compiler and interpreter.
12/20122. What is the difference between Logical AND and Bitwise AND? 12/20121. Give the structure of a ‘C’ program.
2. Provide an example for relational expression and logical expression.?
.1. Define scope and life of variables. 06/2012
2.State the significance of sizeof() and comma operators06/20121. What is a flowchart?
2. What are keywords in C? Give examples.
1. Define algorithm. 12/2011
2.State the difference between %f and %g format specifiers. 12/20111. Write the equivalent ‘C’ expressions for the following equations.
(a) t=(a+b3+ab)2/a+b-1)(b)
2. What is a flowchart? What are the symbols used for I/O and Conditions in a flowchart?
1. Define type casting with an example. 06/2011
2. Apply operator precedence to evaluate the expression 7/22*(3.14+2)/* 3/5. 06/2011
1. Define variable. Give Example. 12/2010
2. List any four math functions. 12/20101. Write the characteristics of Structured Programming Languages.
2. How do constants differ from variables?
1. What are the four different classes of data types? 05/2010 2. What is the precedence associated with the operators in C? 05/2010
1. Write C assignment statements to evaluate the following equation.
T = (2bc/b+c)g 12/2009 2. What is coercion? Give an example. 12/2009
1. Determine the value of the following logical expressionsIf a = 5 b = 10 and c = -6 05-2009
2. Describe the purpose of the qualifiers const and volatile.
(a) a == c || b > a(b) a > b && a < c -05-2009
PART – B Answer ALL the Questions
11. (a) What are the variables used in C program? Explain the rules for them and provide examples in each category.(b) What is bit wise operators? Explain the syntax for them and discuss their uses in C program. 12/2013
11. List the various operators in C and explain any four in detail. 05/2013
11. What is a data type? Explain the data types with suitable examples12/2012
11. (a) Write the differences between top down and bottom up approaches. (4) (b) Draw a flow chart for finding the roots of a quadratic equation. (8)
11(a) Discuss about the different types of constants in C. 06/2012
(b) Write short notes on various logical and relational operators in C. 06/2012
11. (a) Explain the structure of a C program.
(b) Write a note on top down approach.
11.Explain about the various operators supported in C12/201111. (a) What is meant by a Structured Programming? What are
the approaches that are to be adopted in the program development?(b) Give the general format of a C program and describe the various components of a program.
11. (a) If a five digit number is input through a keyboard. Write a program to print a new number by adding one to each of the digits. (For example 12391 is printed as 23402).(b) Illustrate the usage of type definition with an example. 06/201111. What are the different operators available in C? Explain with examples. 12/2010
.1. (a) What is meant by flowchart? Explain the symbols
used for drawing a flowchart.(b) Write the structure of a C program. Explain it with an example program.
11. Write a program to solve the quadratic equation. 05/201011. Explain the hierarchy and associativity of binary operators
in C with example. 12/200911.Explain about the structure of basic C programs? 05-2009
(or)12. Discuss the following:
(a) get ch ()(b) get char ()(c) put char ()-12/2013
12. (a) Discuss the difference between single character input/output functions. (8) 05/2013(b) Write a note on formatted input/output functions.
(4) 05/2013.12. Write a C program to check whether the given number is
prime or not. 12/201212. Mention the various types of operator used in ‘C’. Give example for each12. (a) Explain in detail the formatted input and output
functions. (8) 06/2012(b) Write a C program to evaluate the expression: (4)
where X, Y and Z are small integers. 06/2012
12. (a) Describe the various types of operators in C with suitable examples.(b) What are constants in C? Give its types with an example
12. (a)Write a C program to shift the input data by two bits right.
(b) Write a C program to swap the values of the two variables without using a third variable. 12/2011
12. (a) List the operators available in C. Explain their usage in detail using examples.(b) Explain with an example the effect of applying the rule of precedence in evaluating expressions in C language.
12. (a) Determine the hierarchy of operations and evaluate the following expression 2*3*5/(1+1) – 15/3*(2+2). (b) What would be the output of the following code?
main(){
int x=15;printf(“%d %d %d”, x!=15, x=20,x<30);}
(c) According to Gregorian calendar, it was Monday on the date 1/1/1900. If any year is input through the keyboard, write a program to find out what is the day on I January06/201112. Explain the input/output functions of ‘C’ with suitable example12/201012. Explain the various types of operators available with a sample program for each type12. Write a program to determine and print the sum of the
following series 1 + ½ + 1/3 + …1/n. 05/201012. Mention various data types with size, range of values and
example. 12/200912.Explain the classification of operators in C 05-2009
UNIT II CONTROL STRUCTURES AND FUNCTIONS 10 hrs.Control structures: Conditional control-Loop control and Unconditional control structures.Functions: The Need of a function-User defined and library function- Prototype of a function-Calling of a function-Function argument-Passing arguments to function- Return values-Nesting of function- main()-Command line arguments and recursion. Storage class specifier – auto, extern, static, & register.3. Differentiate between break and continue statements. 12/2013
4. What is the use of switch statements? 12/20133. Write the usage of unconditional control structures. 05/20134. Define: Recursion. 05/2013
3. State the difference between if and while statement? 12/20124. Write a program to find the maximum of two numbers12/20123. How do you use gets() and puts() functions in C?
4. Differentiate between break and continue statement
3. Write a small c program to check whether a given number is odd or even. 06/2012
4. Name the different mechanisms used for passing arguments to function 06/20123. Mention the use of gets() and puts() functions.
4. Give the syntax of switch-case statement in C3. Write a C program to print the first five numbers starting
from one together with their squares. 12/2011
4. What is meant by operator precedence? Give the precedence for logical operators. 12/2011
3. Differentiate between break and continue statements.
4. What is the output of the following statement?For ( ; ; ) printf(“Welcome\n”);
3. What is the use of the keyword ‘static’? 06/2011
4. Given three points (x1,y1), (x2,y2), (x3,y3), write a program to check if all the three points lie on the same line. 06/2011
3. Write a code segment using while statement to print the numbers from 10 down to 1. 12/2010
4. What is the need of command line argument? 12/20103. char s[20] =” Programming in C”;
scanf(“%s”,s);gets(s);What will be the output of this program segment?
4. When can break and continue be used?3. Write a program to read and print real numbers. 05/2010
4. Explain with example the getchar() function. 05/2010
3. Give the impact of omission of initialization, condition and increment expressions. 12/2009
4. Write a C program to find the greatest of given 10 numbers. 12/20093.Write down the difference between do…while and while. 05-2009
4.Write down the steps of looping process. 05-2009PART – B 13. What is nested if-else statement can this be replaced with
switch-case statement always? Explain. 12/201313. Write a C program to display all the prime factors for the
given number ‘n’ using functions. 05/2013 13. Briefly explain the conditional statements with examples
for each. 12/201213. Briefly describe about the loop controls in ‘C’. Give
appropriate examples
13. Explain in detail the conditional control structures in C. Also write a C program to find whether a given number is palindrome or not. 06/2012
13. (a) Explain the single character input and output functions in C with an example.(b) Write a C program to find the largest among three numbers A,B and C.
13. (a) Write a C program to display the following using for loop. z + y + x + ………. + a
(b) With suitable program explain the different parameter passing mechanism of a function12/2011
13. Write a program to read a list of elements consisting of positive, negative and zero values until -999 is entered. The program should count the number of positive, negative and zero elements in the list, and print the counts as output.
13. (a) A positive integer is entered through the keyboard. Write a function to find the binary equivalent of the number using recursion.(b) Illustrate call by value and call by reference with an example. 06/2011
13. Explain the following conditional statements. 12/2010(a) nested if-else statement(b) switch-case statement
13. (a) Give the syntax of scanf ( ) and printf ( ) and explain their usage in C language.(b) Write a C program to accept numbers from the user until their sum exceeds 50.
13. Explain the various ways in which the different data types in C can be read. 05/2010
13. Write a C program to calculate the sum of the remainders obtained by dividing with modular division operation by 2 on 1 to 9 numbers. 12/2009 -05-2009
13.(a) Write a C program for Fibonacci Series.(b) Write a C program to compute the sum of the digits of a given integer number.14. What are the various storage classes available in C?
Explain briefly. 12/201314. Explain the storage class specifier with one example.
05/201314.Write a program to print the entered character in upper caseof lower case by using getchar() and putchar() function12/201214. Write a ‘C’ code to display the result of a student. The conditions are given below:
Marks scored 90 & above I CLASSBetween 70 – 89 II CLASSBetween 50 – 69 III CLASSBelow 50 FAIL
14. (a) Describe the various parameter passing mechanism used in C functions. (8) 06/2012 (b) Write a C program to find the factorial of a given number using a recursive function.(4) 06/2012
14. Explain the various looping statements in C with suitable examples.
14. Define a function to find the sum of diagonal elements of a square matrix and write a main function to test it. 12/201114. Explain with example, the various looping constructs
available in C.
14. (a) Write a C function to evaluate the series sin(x) = x – (x3/3!) + (x5/5!) + … (b) Explore the various storage classes in C with an example. 06/2011
14. (a) Write a C program that reads a number and display whether the number is prime or not using function.(b) Write short notes on storage class specifiers. 12/2010
14. Write a C program to find the roots of a quadratic equation. Use switch case.
14. (a) Write a program to read 10 names and print them.(b) Write a program to read the different data types and print them. 05/2010
14. Discuss and compare the features of printf() and scanf() function. 12/200914. Explain the decision making statements05-2009
UNIT III ARRAYS AND STRUCTURE 10 hrs.Arrays: Single and multidimensional arrays-Array declaration and initialization of arrays-Array as function arguments.Strings: Declaration-Initialization and string handling functions.Structure and Union: Defining structure-Declaration of structure variable-Accessing structure members-Nested structures-Array of structures-Structure assignment-Structure as function argument-Function that returns structure- Union.
5. What is meant by array? Give an example. 12/2013
6. State the differences between arrays and structures. 12/20135. List out the rules to pass a 2D array to a function. 05/20136. Distinguish between structure and union. 05/2013
5. What do you mean by ‘call by reference? 12/20126. What are the different storage classes available in ‘C’?
12/20125. What is the use of strstr() and strrev() functions?
6. List out the storage classes used in ‘C’.5. What is an array? Write the declaration of a single dimensional array. 06/2012
6. Write notes on strcmp() function with example. 06/20125. Define array.
6. List the various storage classes used in C.
5. Is it possible to use multiple default statements in switch ( ) statements? 12/2011
6. Differentiate library function and user defined function. 12/20115. Write any four string manipulation functions.
6. What is the advantage and disadvantage of register storage class?5. What is a nested structure? 06/2011
6. Differentiate a structure and a union with an example. 06/2011
5. What are the advantages of union over structure? 12/2010
6. Write a C program to reverse the given string. 12/20105. What is an index and why does it have to be unique?
6. Define recursion
5. How do you declare a multidimensional array? Give example. 05/2010
6. List any two differences between arrays and structures05/2010
5.Mention any of four functions of stdio.h with their purpose. 12/2009
6. What will be the value of the following function calls?(a) divide(15.3) (b) divide(6.0,1.5)
(c) divide(8,3) (d) divide(9.0, 3) 12/20095.Write down the common operations performed on character strings. 05-2009
6.Define: recursion 05-2009
PART – B 15. How arrays are passed as arguments to a functions?
Describe with suitable C program. 12/201315. Write a C program to perform string concatenation and copying without using build-in function. 05/201315. (a) What do you mean by recursion? 12/2012
(b) Write a C program to calculate the factorial of ‘n’ numbers using Recursion.
15. (a) Write a ‘C’ program to reverse the given 4 digit number.
(b) How will you use multidimensional array in ‘C’? Give a suitable example
15. (a) Explain the declaration and initialization of single and multi dimensional arrays.(7) 06/2012
(b) Write a C program to add 2 matrices.(5) 06/201215. Write a C program to multiply two matrices A and B.
15. Write a C program to replace the zero with the successive number in the following array int x[10]={1,0,3,0,5,0,7,0,9,0} -12/201115. Write a program to read ‘N’ unsorted numbers into an array
and sort and print the array elements in descending order.15. Write a program to obtain the determinant of a square matrix. 06/201115. Write a C program that gets and displays the report of n
students with their personal and academic details using structures. 12/2010
.15. (a) Write a C program to find the transpose of a matrix.
(b) Assume s1 =” Welcome” s2=”hai”.Write a C program to (i) find the length of s1.
(ii) copy to another string s3(iii) compare s1 with s2
15. Write a detailed note on user defined functions. 05/201015. Write a C program to arrange the names in alphabetical order. 12/200915. Write a C program which will read a text and count all occurrences of a particular word. 05-2009
16. Explain about string handling functions in detail. 12/2013 16. What is structure? Explain how the structure is passed as a
function argument with an example. 05/201316. (a) Write short notes on i) strlen( ) ii) strcat( ) iii) strrev( )
iv) strcmp( ) v) strchr( ).
(b) Write a C program to reverse the given string. 12/201216. What is recursion? Provide ‘C’ code for finding the factorial of a number16(a)Write notes on defining and declaring structures in C.
06/2012 (b) Write a C program to create a structure to store roll number, name and marks of all the students in a class and find the total
mark of each student. 06/201216. (a) Explain the various string handling functions used in C.
(b) Write a C program to find the factorial of a given number using recursion.
16. A Yamaha dealer maintains a record of a sales of various vehicles in the following form:
Vehicle Type
Quantity Month/Sales Price
FZ 2 2/99 1,50,000R-15 1 6/2K 1,10,000Fazer 3 9/99 2,40,000
Write a C program to read the above data into an array of structures and print the details of a particular vehicle sold during a specific period. The program should request the user to input the vehicle type and the period. 12/2011
16. Explain the various storage classes available in C with respect to scope and lifetime of each storage classes with an example.
16. An automobile company has serial number for engine parts starting from AAO to FF9. The other characteristics of parts to be specified in a structure are Year of Manufacture, material and quantity manufactured.
(a) Write a structure to store information corresponding to a part.(b) Write a program to retrieve information on parts with serial numbers between BB1 and CC6. 06/2011
16. Write a C program to perform the multiplication of two matrices12/2010
16. List the different storage classes available in C. Explain each of them in detail.
16. Write a program to evaluate A=A + B*C where A,B and C are matrices 05/201016. Write a C program to find the third largest number in an
array12/200916.Explain the storage classes in C 05-2009
UNIT IV POINTERS 10 hrs.Pointers: The ‘&’ and ‘* ’ operators-Pointers expressions-Pointers vs arrays-Pointer to functions-Function returning pointers-Static and dynamic memory allocation in C.DMA functions: malloc(), calloc(), sizeof(), free() and realloc()-Preprocessor
directives.
7. What is dynamic memory allocation? How will you achieve it? 12/2013
8. Define macro. Give an example. 12/20137. What would be the equivalent pointer expression for referring the array element a [I] [J] [K]? 05/2013
8. What is dynamic memory allocation? 05/20137. Write any three comparison between call by value and call
by reference. 12/20128. Define static memory allocation. 12/20127. Create an array of pointers using ‘C’.
8. Create a union variable for a book.
7. What are the advantages of using pointers? 06/2012
8. What is the need for performing dynamic memory allocation? 06/20127. How is a pointer variable declared and initialized?
8. What is union?
7. How do functions help to reduce the program size? 12/2011
8. Mention the significance of void as return type in function definition. 12/2011
7. What is a pointer?
8. Write the structure for an EMPLOYEE with attributes Employee number, name, address, HRA, DA, CCA, PF, LIC. Declare an array of 50 employees with structure Employee.
7. Illustrate the use of pointers to pointers with an example. 06/2011
8. Enlist the differences between malloc() and calloc() functions in c, 06/2011
7. What is meant by malloc() function? Give example12/2010.
8. Differentiate pointers with arrays. 12/2010
7. What is the use of ‘*’ and ‘->’ operators in pointers?
8. How is a structure different from an array?
7. How do you declare an array of structures? 05/2010
8. Distinguish between (*m) 5 and *m[5]. 05/20107. Difference between structure and union. 12/2009
8. What is the relationship between array and a pointer variable? 12/20097.What is a pointer? How is a pointer initialized? 05-2009
8.Write down the difference between structure and union. 05-2009
PART – B 17. How do pointers are related to arrays? Explain in detail. 12/201317. Write a C program to perform matrix multiplication by
using pointers. Create the matrices by using dynamic memory allocation. 05/2013
17. (a) What do you mean by Dynamic memory allocation?(b) Write a program to print Fibonacci series using Dynamic memory allocation. 12/2012
17. Store and display the mark details of the students in a class using structures in ‘C’ language.
17. Explain the following:(a) Pointer and arrays (b) Pointer to Functions-06/2012
17. (a) Explain the call by reference with an example C program.
(b) Write briefly about array of pointers in C.
17Write a C program to find the transpose of a two dimensional matrix using dynamic memory allocation12/201117. Define a structure Student consisting of Roll no, name,
Test1, Test2, Seminar, Semester marks and create an array of ‘N’ Student.(a) Write a program to print the Roll No, Name, Internal Mark, External Mark, and Total Mark.(b) Calculate the grade of the student based on total mark using the following table
Mark Grade>95 ‘S’85 <= M <=95 ‘A’75 <= M <=85 ‘B’65 <= M <=75 ‘C’55 <= M <= 65 ‘D’ >=50 ‘E’ <50 ‘F’
17Write a program to perform insert, delete and count the nodes in a linked list using dynamic memory allocation. 06/2011. 17. Differentiate pass by value and pass by address in C. Give
example. 12/201017. (a) Write a C program to swap two numbers using
pointers and without using pointers.(b) How can an array of pointers be accessed? With an example program, explain in detail.
17. (a) Write a program using structures to store students data.
(b) Compare unions and structures. 05/201017. Write a C program to display array elements and their
address using pointers. 12/200917.Explain the structures and unions in C with an example. 05-200918. Discuss the following: 12/2013
(a) malloc ()(b) calloc ()(c) free ()
18. Why preprocessor directives are required? Discuss in detail about various preprocessor directives. 05/201318.(a) Define union . Give the comparison of structure and Union.(b) Write a program to read and write employee and their date of joining using nested structure. 12/201218 Using pointers in C, sort and display the given ‘n’ names in
alphabetical order.18. Write a C program to count the length of a string using pointers and explain. 06/201218. Define a structure called student would contain name,
regno and marks of 5 subjects and percentage. Write a program to read the details of name, regno and marks of 5 subjects for 25 students, calculate the percentage and display the name, regno, marks of 5 subjects and percentage of each student.
18. Write a C program to add the odd elements present in an array by creating an array using malloc( ). 12/2011
18. Write a program to dynamically create an array of ‘N’ elements and find the sum and average of ‘N’ elements.
18. Write a program to sort n numbers using a function that accepts a pointer to access the array elements06/201118. Explain the different types of memory allocation functions
with examples12/201018. Write a structure with following members: student name,
student roll no, three subjects marks, total, percentage. Find the sum and percentage of marks for 10 students.
18. Write a program to sort a set of names in ascending order using pointers05/201018. Discuss and compare array of structures and nested
structures12/200918.Explain the pointers as functions arguments in C. 05-2009
UNIT V FILE MANAGEMENT AND GRAPHICS 10 hrs.File management: Defining, opening & closing a file, text file and binary file- Functions for file handling: fopen,fclose, gets, puts,fprint, fscanf, getw, putw, fputs, fgets, fread, fwrite-Random access to files: fseek, ftell, rewind-File name as Command Line Argument.Graphics in PC-Initialize Graphics Mode-Functions used In Graphics - Drawing a Point on the Screen-Drawinglines, rectangles, ovals, circles, arcs, polygon, filling colors-Using Text in Graphics Display.9. What is a manipulator? 12/201310. What is an I/O stream? 12/20139. How to initialize the system in graphics mode? 05/2013
10. What is a command line argument? 05/20139. What is the difference between printf() and fprintf() ?
12/201210. Give the rules for defining preprocessor. 12/2012
9. Write a statement in C for opening the file “test.txt” in write mode?
10. What is the purpose of using command line arguments
9. Give the meaning of any four file I / O functions. 06/2012
10. Write down the general syntax of setlinestyle( ). 06/2012
9. What is the primary advantage of using a data file?
10. State the use of fseek() function in C.
9. What is the use of typedef statement? 12/2011
10. Give the syntax of structure. 12/20119. Write the general syntax and use of fseek function.
10. What is a file? Write the syntax for opening a file in read mode in C.
9. What is meant by device independent drawing? 06/2011
10. How is EOF detected? 06/20119. What is meant by preprocessor directives? 12/2010
10. Give the importance of graphics packages. 12/20109. What is a file?
10. Mention the use of fprintf and fscanf.9. What is the significance of EOF? 05/2010
10. What are command line arguments? 05/20109.Differentiate sequential file and random access file. 12/200910. Assume you are opening a file in ‘a+’ mode. What will happen?
(a) if file exists, and(b) When file does not exist12/2009
9.Write down the four file library functions. 05-2009
10.Write down the significance of EOF 05-2009PART – B 19. Explain about fs can t and fread file handling functions in detail. 12/201319. Explain the functions for file handling with one common
example. 05/201319Writeaprogram tostore three records in one structure. 12/201219. Write a ‘C’ program to copy the content of a given text file
to another file19. Explain the following functions: 06/2012 (a) fopen( ) (b) fclose( ) (c) fprintf( ) (d) fscanf(19. (a) Explain the different modes in which a file can be opened.(b) Briefly explain the various I/O operations on files with suitable examples19. Write a program to animate the ball using Graphics in C12/201119. Write a file program to read a data file ‘NUM.DAT’
consisting of positive numbers and copy and odd numbers into ‘ODD.DAT’ and even numbers into file ‘EVEN.DAT’.
19. Write a program to read a list of words, sort the words in alphabetical order and display them one word per line. Also calculate the number of words in the list. Output format should be:(a) Total number of words in the list is _________(b) Alphabetical listing of words.
_______
_______06/201119. Discuss the file handling functions of C in detail with
suitable example. 12/201019. Explain the steps that are followed while accessing a file.19. List all the functions that are associated with files. 05/2010
19. Write a C program to write data to a text file and to read it. 12/200919.Write a C program to copy the contents of one file to another. 05-200920. Write a C program to create a file with a number of integers. 12/2013.20. Write a C program to display the Indian flag with
appropriate colors and title. 05/201320. Write a program to create student database using Indexed sequential file12/201220. Write a ‘C’ program to concatenate the given strings in the
command line.20(a) Discuss about some basic graphics functions in C(8) 06/2012(b) Write a C program to draw a rectangle and circle.(4) 06/201220. Write a C program to copy the contents of a file to another. Read the source file name and target file name using command line arguments20. Write a C program to read the contents of one file and
change the characters into numbers and numbers into characters and display. 12/2011
20. What are command line arguments? Write a command line program to copy the contents of file 1 and file 2 to file 3.
Fcopy <file 1> <file2> <file3>
20. Write a program to create chessboard like boxes (8X 8) in the client area. If the window is resized the boxes should also get resized so that all the 64 boxes are visible at all times. 06/2011
20. Discuss the C functions used in graphics in detail with suitable example12/201020. Explain how random access is done in a file.20.Write a program to append a file and write it to a new file05/201020. Explain how to create and access sequential and random file in C. 12/200920.Explain the command line arguments with an example05-2009