Assignment Semister1
Assignment Semister1
1. What are different data types in C. Explain in terms of memory size, format
specifier and range.
2. What is an array? How can a single dimension and two dimensional arrays
are declared and initialized?
3. Explain the different types of loops in C with syntax.
4. Explain if, if-else and switch with examples and syntax.
5. Write a ‘C’ program to find whether the given string is palindrome or not
6. Write a C program to check whether a given character is a vowel or not
7. Explain the switch statement with syntax and examples.
UNIT-2
1. What is a pointer? Explain how the pointer variable is declared and
initialized.
2. What is structure? Explain C syntax of structure declaration with example.
3. With a suitable example, explain the differences between a structure and a
union in C.
4. How to access array elements? Explain with example
5. How do you declare, initialize and access a structure containing arrays?
Explain the same with examples.
6. What is an array? Explain the declaration and initialization of one
dimensional and two dimensional arrays with an example?
7. Write a C program to swap two numbers using pointers and functions.
8. Mention the difference between a Union and a structure.
9. What is a pointer? How does it help in dynamic memory allocation?
10. Explain with example the following string function-
a. strlen()
b. strcpy()
c. strcmp()
d. strcat()
e. strstr()
UNIT-3
1. Explain different categories of preprocessor directives used in C.
2. What is pre-process? What are its advantages? Explain any three
pre-process in C.
3. Write a C program to open a file and read the file and print the file contents
4. Differentiate between sequential files and random access files?
5. What is the preprocessor directive? Explain #define and #include
preprocessor directives.
6. Using the prototypes explain the functionality provided by the following
functions.
7. Using the prototypes explain the functionality provided by the following
functions:
a. fread()
b. fwrite()
8. What is a file? Explain how the file open and file close functions are
handled in C.
9. Explain the types of files in C and the operations that can be performed on
them, with examples.
10. Why do we use “File” in C Language? Explain types of files and the
Operating modes of files.
11. Explain the following file function with example:
f. fopen()
g. fclose()
h. rewind()
i. ftell()
j. fseek()
UNIT - 4
1. Elaborate the importance of dynamic memory allocation with examples.
2. Write a C program to calculate addition of two numbers using functions
3. What is a function? Explain different classification of user defined functions
based on parameter passing and return type with examples
4. Write a C program using a function to check whether the given number is
prime or not.
5. What is the difference between the function malloc() and calloc()?
6. What is a function? What is function definition and function call?
7. What is a function? Write a function to find the sum of two numbers.
8. What is dynamic memory allocation? Write and explain the different
dynamic memory allocation functions in C.
UNIT - 5
1. Explain and illustrate the linear search algorithm on the below array.
Search for the key 19.
Array: [15, 28, 43, 7, 19, 84, 56]
2. Explain how the algorithm works and provide a step-by-step
implementation of the sorting process after each pass. Sort the following
array using the bubble sort algorithm.
[38, 27, 43, 3, 9].
3. Explain the difference between binary searching technique and linear
searching technique.
4. Explain how the algorithm works and provide a step-by-step
implementation of the sorting process after each pass. Sort the following
array using the selection sort algorithm [38, 27, 43, 3, 9, 23, 50].
5. Explain how the algorithm works and provide a step-by-step
implementation of the sorting process after each pass. Sort the following
array using the insertion sort algorithm [5, 27, 48, 64, 15, 21, 10].