Thursday, November 26, 2009

Online bits of 'C' and datastructures

Code No. 07A1EC01 UNIT-3
C PROGRAMMING AND DATA STRUCTURES

1. What are strings? How are they declared? Explain the different functions related to strings ?
2. What is the a NULL character? Is it possible to initialize NULL character in the string?
3. Why is it necessary to count NULL character while declaring string? Explain with an example?
4. What is the difference between the functions strcmp () and stricmp () ? Explain with an example?
5. What is the use of strrev ( ) and strlen ( ) functions? Explain with an example?
6. What is the use of strcpy () and strdup () functions? Explain with an example?
7. What is the difference between strcpy () and strncpy () functions? Explain with an example?
8. What are pointers? Why are they important?
9. Explain the features of pointers?
10. Explain pointer of any data type that requires four bytes?
11. what is an array of pointer? How is it declared?
12. Explain the relation between an array and a pointer?
13. Why addition of two pointers is impossible? What are the possible arithmetic operations with pointers?
14. How strings are stored in the pointer variable s? Is it essential to declare length?
15. What is the base address? How is it accessed differently for one – dimensional and two dimensional arrays.
16. Distinguish between the address stored in the pointer and the value at that address? Why does element counting of arrays always start from “0” ?
17. Write a program to add two matrices?
18. Write a program to multiply two matrices?
19. What conditions must be satisfied by entire elements of any given array? In what way array is different from an ordinary variable?
20. Write a program to read string from keyboard and display it using character pointer?
21. Write a program to interchange elements of character array using pointer?
22. Write a program to display address of elements and pointers?
23. Write a program to display the number of days of given month of a year/
24. Write a program to find the similar elements in an array and find the occurrence of similar numbers for number of times?
25. Explain the difference between call by reference and call by value?
26. Write a program using pointers to read in an array of integers and print its elements in reverse order?
27. Write a program using pointers to add two matrices and to return the resultant matrix to the calling function?
28. Explain the memory management functions?
29. What are command line arguments? Explain?
30. Using pointers, write a program to sort the given numbers in ascending order?
-oOo-



Code No. 07A1EC01 UNIT-4
C PROGRAMMING AND DATA STRUCTURES

What are derived data types? Explain?
Explain the different derived data types?
Describe the declaration and initialization of structures with an example?
Describe the declaration and initialization of unions with an example?
Enumerate the difference between structure and union?
Bring out the difference between structures and unions with regard to memory allocation with examples?
Write a program to display size of structure elements. Use sizeof( ) of operator?
With an example explain structure within structure?
What is a structure in C? How structure is declared?
Explain the nested structure with an example?
How arrays of structure variables defined? How are they beneficial to the programmer?
How structure elements are accessed using pointer? Which operator is used? Explain with an example?
Is it possible to pass structure variable to function? Explain in detail the possible ways?
Explain the importance of bit fields? How do bit fields save memory space?
What is a UNION in C? How data is stored using union?
What do you mean by nested structure? Explain?
What do you mean by array of structures? Explain?
Explain the advantages of structure type over the array type variable?
When are array of structures used? Declare a variable as array of structure and initialize it?
Distinguish between an array of structures and array within a structure? Give an example of each?
Explain the different ways of passing structure as arguments in functions?
Write a C program to illustrate the method of sending an entire structure as a parameter to a function?
Define the structure to represent a date. Use your structure that accept two different dates in the format mmdd of the year and do the following: Write a C program to display the month names of both dates.
Write a C program using structure to create a library catalogue with the following fields: Access number, Author’s name, Title of book, Year of publication,Publisher’s name, Price.
Write a program to use structure within union. Display the contents of structure elements?
Write a program to pass address of structure variable to user defined function and display the contents?
Write a program to create a student structure? Create an array of structure objects. Read and display the contents of the structure?
Write a program to create array of structure objects?
What is a structure? How it is declared? How it is initialized?
What is a bit field? Explain its features?
-oOo-
Code No. 07A1EC01 UNIT-5
C PROGRAMMING AND DATA STRUCTURES

Describe the use and limitations of the function getc and putc?
What is the significance of EOF? How does an append mode differ from a write mode?
Explain the general format of fseek function?
What is the difference between the statements rewind(fp); and fseek(fp,0L,0);?
Explain the way of defining, opening and closing a file.
Explain the different modes of operation of a file.
Define a file and elaborately discuss about reading, opening and closing of a file.
Distinguish between getchar and scanf functions for reading strings.
Distinguish between text mode and binary mode operation of a file?
Distinguish between the following function with examples
scanf( ) and fsacnf( )
getc( ) and getchar( )
Distinguish between the following function with examples
scanf( ) and fsacnf( )
putc( ) and fputc( )
Distinguish between the following function with examples
Putc( ) and fputc( )
getc( ) and getchar( )
Distinguish between the following function with examples
ferror( ) andperror( )
getc( ) and getchar( )
Distinguish between the following function with examples
ferror( ) and perror( )
feof( ) and eof( )
Distinguish between the following modes with examples
w and w+
r and r+
Distinguish between the following modes with examples
rb and rb+
a and a+
Distinguish between the following modes with examples
a and a+
r and r+
Explain low level disk operations?
Explain command line arguments?
How re-direction of input and output is done? Explain in brief?
Write a program to display the contents of file on the screen. The program should ask for filename.
Write a program to combine contents of two files in a new file?
Write a program to display the contents of one file in reverse format into another file?
Write a program to swap the contents of two files?
Explain the command line arguments. What are the syntactic constructs followed in ‘C’.
Write a C program to read data from the keyboard, write it to a file called INPUT, again read the same data from the INPUT file, and display it on the screen.
Write a program to copy up to 100 characters from a file to an array? Then copy the contents of an array into another file?
Write a program to read the contents of three files and find the largest file?
Write a program to detect and print the error message using perror( ) function?
Write a program to write a block of structure elements to the given file using fwrite( ) function?




-oOo-

1 comments: