Allunits Questionbank
Allunits Questionbank
Allunits Questionbank
QUESTION BANK
C PROGRAMMING
(07CE105 / 07ME105 / 07MT105 / 07EC105 / 07EE105 /
07EI105 / 07CS105 / 07IT105 / 07CH105 / 07FT105)
1
C Programming – Question bank
UNIT I
PART A
1. Access of several instructions at once is a ---------------- processing.
2. Laptop is a ---------------computer
3. FLOPS is-------------------
4. Computer require -----------to process data and store output
5. The physical form of output is known as --------------
6. Mention the examples of operating systems?
7. -------------is a software used to compose, format, edit and print electronic
document.
8. The spread sheet provides sheets containing the ------------
9. What is the expansion of GPRS?
10. What is the expansion of PSTN?
11. What is the expansion of ISTN?
12. What is the expansion of MSC?
13. What is the expansion of TCP/IP?
14. What is the expansion of VOIP?
15. What is a website?
16. What is a webpage?
17. Give the types of browsers?
18. What is expansion of URL?
19. High speed internet access ranging from -----------------------
20. -----------is a collection of similar objects.
21. What is the general format of an assembly instruction?
22. ---------is also known as the index page.
23. The development of computer can be divided into -----------generations.
24. Analytical engine was developed by-------------
25. UNIVAC is an example of------------
26. The unit that perform the arithmetic and logical operations on the stored numbers
is known as-------------
27. Linux is a type of ------------software.
28. Which of the following option is included in E-learning?
a. computer-based training b. web-based training
c. Both (a) and (b) d. None of these.
29. Which of the following activity can be termed as software piracy
a. Soft loading b. Counterfeiting
c. Renting d. All of these
30. ------------ is a programming language, which runs on the browser.
31. ------------ is a client-based language, which runs only on the internet explorer.
32. ASP scripts run on the -------------
33. ------------- is a web page developing language the enables programmer to create
customized tags.
34. computers work on a set of instruction called-------------
35. -------------- are one of the most basic tools that are used to develop the problem
solving logic.
36. -------------- is a pictorial representation on of an algorithm.
2
C Programming – Question bank
PART B
1. What is software piracy?
2. What are the advantages of transistors over vacuum tubes?
3. What is a newsgroup?
4. Distinguish between Internet and WWW?
5. Write short notes on Compiler?
6. Write short notes on Interpreter?
7. Write short notes on Linker?
8. Write short notes on Assembler?
9. Specify the application of computers?
10. Define parallel processing?
11. Define Artificial Intelligence?
12. What is meant by registers?
13. List out the various types of system software?
14. List out the various types of application software?
15. Mention the role of Information Technologies?
16. What is a web page?
17. Define a leased line?
18. List out any six flowchart symbol?
19. Mention the benefits of flowchart?
20. Define Encapsulation?
21. Define Inheritance?
22. Define Abstraction?
23. What is object?
24. What are all the characteristics of a good program?
25. Define a loader?
26. List the characteristics of second generation computer?
27. What is meant by hand-held computers?
28. Explain the types of memories?
29. What is meant by image editors?
30. What is meant by spread sheets?
3
C Programming – Question bank
PART C
1. What do you understand by software? Discuss its types.
2. Explain the steps involved in the process of booting?
3. Explain how software is installed and uninstalled?
4. What is software piracy and how can it be avoided?
5. Discuss the various types of computers in detail.
6. Discuss the various computer generations along with the key characteristics of the
computer of each generation?
7. List the various services provided by the Internet?
8. Explain the roles of Information Technology?
9. Discuss the careers in Information Technology?
10. Briefly explain the Evolution of Internet?
11. Explain the Basic Internet terms?
12. Explain how we connect the internet and mention the types of internet
connection?
13. Explain the program development cycle?
14. What do you understand by problem solving techniques? Discuss its types.
15. Explain the program control structures?
16. What is meant by programming paradigms and explain its types?
17. Discuss the various programming language generations?
18. Explain in detail about the language translators?
19. Briefly explain the evolution of a computer?
20. Draw the block diagram of a computer and explain its basic organization?
21. Write the algorithm and draw the flowchart for the following:
i) To find the sum and average of two numbers
4
C Programming – Question bank
5
C Programming – Question bank
32. What is the difference between float and double data types?
33. Mention the basic data types supported in C with their range of values allowed for
them.
34. How many bytes are allocated for int, float, char and double?
35. Differentiate between \n and \r.
36. Write a C statement to declare constant of type int.
37. What is meant by keywords? Give example.
38. What is the ternary operator available in C?
39. Mention the difference between ‘a’ and “a”.
40. What the increment and decrement operators present in C?
41. Define the term operator and operand.
42. Write a C statement for the expression : i. c=(f-32) * 5
9
ii. a=2пr
43. What is the header file to be included for using scanf() and printf().
44. What is the use of clrscr()?
45. What is the header file that define pow()?
46. Why is C called structured programming language?
47. Differentiate between the constants and variables.
48. What is meant by initialization?
49. What is the difference between & and && as operators?
50. Give the output of the following
i. int i=10, j, k;
k=++i;
j=i++;
printf(“%d%d%d”,i,j,k);
PART – B
1. What are the relational and logical operators available?
2. What is the use of ternary operator?
3. Mention the unary operators and state their use.
4. Differentiate between logical and bitwise operators.
5. List the operators with the priority from highest to lowest.
6. What will be the value of ‘x’ after execution of the following program?
main()
{ int x=!0*10; }
7. What are formatted and unformatted functions?
8. What is the difference between character I/O and string I/O?
9. What are escape sequence characters?
10. List any four escape sequences with their uses.
11. Give the difference between puts() and putch().
12. What is the difference between getch() and getche()?
13. How is cgets() different from gets()?
14. How will you execute a doc command through C?
15. What is the use of exit() function?
16. Define Library function.
6
C Programming – Question bank
7
C Programming – Question bank
printf(“%d”,i1); }
50. What is the output of the following :
i. #include <stdio.h>
main()
{
int i1=1023.3456;
printf(“%d”,i1); }
51. Identify the errors in following :
i. #include <stdio.h>
main()
{
char x,y;
int z;
x=a;
y=b;
z=x+y;
printf(“%d”,z); }
52. Identify the errors in following :
i. #include <stdio.h>
main()
{
float area;
int r=4;
area=31.4 * r ** 2
printf(“%d”,area); }
53. Identify the errors in following :
i. #include <stdio.h>
main()
{
int r=4;
area=31.4 * pow(r,2);
printf(“%d”,area); }
PART C
1. Write in detail about the logical and relation operators supported in C with
example.
2. Write a C program to find the biggest of three numbers. Use conditional
operators.
3. Write a program to enter a number and carry out modular division operation by 2,
3 and 5 and display the remainders.
4. Write a program to convert the given decimal number to octal and hexadecimal.
5. Write a C program to input the rainfall of 3 consecutive days in cms and find its
average.
6. Find the Simple Interest? Inputs are principal amount, period in years and rate of
interest.
8
C Programming – Question bank
7. Write a program to get two times in hrs and mts.Add them and the result must be
in hrs and minutes.
8. Write a program to find the reverse of a given number.
9. Write a program to display list of C program files and directories. Use system()
function to execute DOS commands.
10. Write a program to enter the temperature in Fahrenheit and convert into celcius
and vice versa.
11. Summarize the purpose of flags that are commonly used with printf function.
Illustrate with examples.
12. Write a program to get a line of text and convert into upper or lower case without
using library functions.
13. Write a C program to print the Pascal’s triangle.
14. What are the different data types present in C. Consider the qualifiers too.
Mention the size and range supported by each of them. Also specify the format
specifier for each type. Give examples also.
15. Write a program in C to calculate simple and compound interest.
16. Write a C program to perform different arithmetic operations like addition,
subtraction, multiplication, division and finding reminder.
17. Explain in detail about the operator precedence.
18. With suitable examples, write about the bitwise operators supported in C.
19. Write a program in C to calculate area of the triangle
i. given the three sides
ii. give the base and height.
20. If a,b,c,d and e are declared using the statement
int a,b,c,d,e;
What is the value assigned to the variable a in the following statement.
a=b>c ? c > d ? 12 : d > e ? 13 : 14: 15 in each of the following cases:
i. b=5,c=15,d=e=8;
ii. b=15,c=10,d=e=8;
iii. b=15,c=10,d=e=20;
iv. b=c=9,d=20,e=19
21. Write a program to find the sum and average of 5 numbers.
22. Write in detail about type casting. Give examples
23. With examples, explain about various escape sequences.
24. Using conditional operator, write programs in C for the following
i. To find the maximum among two numbers.
ii. To fine whether a given number is odd or even.
iii. To fine whether a given number is positive or negative
25. Write a program to swap values of 2 variables with and without using temporary
variable.
UNIT III
PART A
1. What is sequential execution?
2. Give the syntax of simple if statement.
3. Give the flowchart of simple if statement.
4. Can a single if statement have more than one else construct.
9
C Programming – Question bank
5. What is break?
6. What is continue?
7. Give a difference between break and exit.
8. When does the default is executed in switch statement.
9. What would happen if break is not used in switch?
10. “It is not advisable to use unconditional statement in a program”. Comment.
11. Write a C program to check whether a number is divisible by 3 or not.
12. What is the output of the following code?
main()
{
int var = 3;
for (;var++=0;) printf(“%d”,var);
}
13. What is the output of the following code?
main()
{
int var1 = 0; int var1 = 20; char num1 = 1; char num2 = 10;
if (var1,var1,num1,num2)
printf(“computer”);
}
14. What is the output of the following program?
main()
{
int a = 10;
if (a=11)
printf(“True”);
else
printf(“False”);
}
15. Define loop.
16. How could you write infinite loop using for?
17. What is the output of the following code?
main()
{
unsigned int var = 10;
for (;var- >=10;)
printf(“%u”,var);
}
10
C Programming – Question bank
case 1: printf(“1”);
case 2: printf(“2”);
default: printf(“0”);
}
}
20. Can multiple values be used in case label list?
21. Give the reason for having control structures in C.
22. What are the data types that can be used for the selector of the case statement?
23. What is the output of the following statements
for(i = 10; i++; i<100)
printf(“%d \n”,i);
24. What is the output of the following statements?
for(i=0;i<10;i++);
printf(“%d\n”,i);
25. What is the difference between for and while loop.
26. What is the difference between while and do-while.
27. What is a comma operator? Within which control statement does the comma
operator usually appear?
28. How an individual array element identified?
29. What is the output of the following
int j;
while (j<=10)
{
printf(‘\n%d”,j);
j=j+1;
}
30. What is the output of the following?
int i=1;
while (i<=10);
{
printf(“\n%d”, i);
i++;
}
30. What is the output of the following?
main()
{
char ch;
for(ch=65; ch<=255; ch++)
printf("%d%c\n",ch,ch);
}
32. Write a C program to print the string “WordProcessing” in the following
format.
a. Word Processing
b. Word
c. W.P
33. What is the use of sscanf statement?
11
C Programming – Question bank
PART B
1. Give the syntax of if-else statement.
2. Give the flowchart of the if..else construct.
3. Write a C program to find the greatest of two numbers.
4. Write a C program to find whether the given number is positive or negative.
5. Write a C program to find the smallest of two numbers.
6. Give the flowchart of continue statement.
7. List down the control statements supported by C language.
8. What is unconditional statement in C? Give its syntax.
9. Write down the sequence of actions performed when the goto statement is
executed.
12
C Programming – Question bank
13
C Programming – Question bank
*
* *
* * *
46. Write a C program to read a matrix and display the matrix using array.
47. Write a C program to check whether a given year is a leap year or not.
48. Write a C program to check whether the entered character is an uppercase or
lowercase letters or digits.
49. Write a C program to check whether the triangle is isosceles, equilateral, scalene
or right angled triangle.
50. Write a program to check whether a given number is divisible by 7 or not.
PART C
1. Explain the control statements available in C with its syntax.
2. Write a C program to calculate the electricity bill by accepting the starting and
ending meter reading.
3. Write a menu driven program to perform the functions of a calculator.
4. Explain switch statement.
5. Write a C program to display the multiplication table of a number given by user.
6. Write a C program to generate fibonacci series.
7. Write a C program to check whether a given number is prime or not.
8. Write a C program to display the pascals triangle.
9. Write a C program to find the roots of a quadratic equation.
10. Write a C program that reads in N numbers and find the smallest and greatest
number.
11. Write a C program to process the marks obtained by a student and also display the
class obtained by them.
12. Explain for statement and explain its working.
13. Write a C program to check whether the given matrix is symmetric
(Hint: Matrix A = Transpose of Matrix A)
14. Write a C program to count the number of vowels and consonants in a character
array (String).
15. Write a C program to convert the individual character in a string in to its
equivalent ASCII values
16. Write a C program to get 5 numbers and find out whether they are prime number
or not.
17. Write C program to find the factorial of N numbers using do-while loop.
18. Write a C program to display series of numbers as given
1
2 1
3 2 1
4 3 2 1
4 3 2 1
3 2 1
2 1
1
19. Write a C program to multiply two 3*3 matrices.
14
C Programming – Question bank
UNIT IV
PART-A
1. We can use the conversion specification _______ in scanf to read a line of text.
2. We can initialize a string using the string manipulation function_______.
3. The function strcat has _______ parameters.
4. To use the function atoi in a program we must include the header file _______.
5. The function _______ does not require any conversion specification to read a string
from the keyboard.
6. The function ________ is used to determine the length of the string.
7. The ________ string manipulation function determines if a character is contained in a
string.
8. The function _______ is used to sort the strings in alphabetical order.
9. The function call strcat(s2,s1) appends ____ to _____.
10. The printf may be replaced by ________ function for printing strings.
11. The header file _____ is required when using character handling functions.
12. Strings are ______ of characters.
13. The characters of the string are enclosed within a pair of _____.
14. A ______ character terminates the string.
15. The function ______ compares two strings.
16.The parameters used in a function call are called _______.
17. A variable declared inside a function is called ____.
18.By default, ______ is the return type of a C function.
19. In passing by pointers, the variables of formal parameters must be prefixed with
_____ in their declaration.
20. In prototype declaration specifying ______ is optional.
21. _____ refers to the region where a variable is actually available for use.
22. A function that calls itself is known as a _______ function.
23. If a local variable has to retain its value between calls to the function, it must be
declared as ______.
24. A _______ aids the compiler to check the matching between the actual arguments and
the formal ones.
25. A variable declared inside a function by default assumes ______ storage class.
26. Find the error in the following function call: xyx(void);
27. A ____ must always follow the closing brace of the function declaration.
28. A pointer variable contains as its value the ______ of another variable.
15
C Programming – Question bank
29. The ______ operator is used with a pointer to dereference the address contained in the
pointer.
30. The ______ operator returns the value of the variable to which its operand points.
31. The only integer that can be assigned to a pointer variable is ______.
32. The pointer that is declared as ______ can’t be dereferenced.
33. ______ directive defines a macro substitution.
34. The output of the _______ is processed by the actual compiler.
35. The _______ directive discards a macro.
36. A _______ refers to a C program with all its header files.
37. An _______ variable does not retain its value once control is transferred out of its
defining function.
38. External variables are often referred to as ________.
39. _______ is the programming concept where in the use of pointers becomes
indispensable.
40. All variables that can be accessed directly (by their names) can also be accessed
indirectly by means of ______.
41. Functions that have been already written compiled and placed in libraries are called
_______.
42. Function declarations are also called _______ since they provide the model of the
function.
43. ______ are the means of communication between the calling and called functions.
44. The variables defined in function definition are known as _________.
45. Variables that specify the values that are passed to the function are called ______ in a
function call.
46. The process of assigning the address of a variable to a pointer variable is known as
_______.
47. Subsequent occurrence of a macro with arguments is known as _______.
48. The return type must be _______ if no value is returned.
49. The indirection operator (*) is also known as __________.
50._______ refers to the accessibility of a variable from the memory.
PART-B
1. Mention the common operations that can be performed on character strings.
2. List the limitations of using getchar and scanf functions for reading strings.
3. What will be the output of the following statement?
printf(“%d”,strcmp(“push”,”pull”));
4. Compare the working of strcpy and strncpy.
5. What will be the output of the following code?
char s1[]=”INFORMATION” ;
char s2[]=”TECHNOLOGY”;
printf(strstr(s1,s2));
6. Compare the operations of strcat and strncat.
7. Write a program to extract a portion of a character string and print the extracted
string.
8. How the functions in C are classified?
9. What are functions?
16
C Programming – Question bank
10. The main is a user-defined function.How does it differ from other user-defined
functions?
11. What is prototyping? Why is it necessary?
12. Distinguish between actual and formal arguments.
13. When a function is said to be recursive? Also specify where it can be used?
14. Mention the different ways of passing parameters to functions.
15. How can you differentiate scope and visibility of variables?
16. Write a C program to multiply two numbers.
17. Write a function prime that returns 1 if its argument is a prime number and returns
0 otherwise.
18. Write a function that will scan a character string passed as an argument and
convert all lowercase characters into their upper case equivalents.
19. Distinguish between (*m)[5] and *m[5].
20. Do the declarations char s[5]; char *s; represent the same, Explain.
21. Which one of the following is the correct way of declaring a pointer to a function?
Why? a) int (*p) (void); b) int *p (void);
22. What are the differences between procedure and function.
23. When are sub programs used as parameters.
24. What is mutual recursion?
25. What are the differences between direct and indirect invocation?
26. Explain briefly the concept of call by value and call by reference parameters.
27. What are the three parts of recursive definition?
28. What is the necessity of a return statement? when is it necessary and when is it
must?
29. What are the advantages of modular programming?
30. What do you understand by nesting of subprograms?
31. What would be the output of the following program?
main()
{
int num;
num=func(20);
printf(“%d” ,num);
}
int func(int num)
{
num>20?return(100):return(200);
}
32. What would be the output of the following program?
main()
{
printf(“\n computer”);
main();
}
32. What is the difference between a function declaration and a function definition?
33. Distinguish between recursion and iteration.
34. Write a program to concatenate two strings.
17
C Programming – Question bank
PART C
1. Write a program, which reads your name from the keyboard and outputs a list of
ASCII codes, which represent your name.
2. Write a program to do the following:
a) To output the question “Who is the inventor of C?”
b) To accept an answer.
c) To print out “Good” and then stop, if answer is correct.
3. Write a program to extract a portion of a character string and print the extracted
string. Assume that m characters are extracted,starting with the nth character.
4. Write a program which will read a text and count all occurrences of a particular
word.
5. Write a program which will read a string and rewrite it in alphabetical order.For
example, the word STRING should be written as GINRST.
6. Write a program that reads a string from the keyboard and determines wheter the
string is a palindrome or not.
7. Write a program to read two strings and compare them using strncmp() and print a
message that the first string is equal, less, or greater than the second one.
8. Write a program to read a line of text from the keyboard and print out the number
of occurrences of a given substring using the function strstr().
9. Write a program to create a directory of students with roll numbers. The program
should display the roll number for a specified name and vice-versa.
18
C Programming – Question bank
19
C Programming – Question bank
UNIT V
PART A
1. Typedef is _______ datatype.
2. Write the syntax for typedef.
3. The _______ can be used to create synonym for a previously defined data type.
4. A _______ is a collection of data items under one name in which the items share the
same storage.
5. The name of a structure is referred to as _______.
6. The selection operator requires the use of a _____to access the members of a
structure.
7. The variables declared in a structure definition are called its _______.
8. The keyword _______ must precede a structure name.
9. The precedence of the member operator is _______ than all arithmetic and relational
operators.
10. Structures within a structure mean ________.
11. All members of a _______ use the same location.
12. Structure member can be accessed by writing ________.
13. ________ structures are very useful in applications that involve linked data structures
such as lists and trees.
14. Unions are used to conserve _______.
15. ______ is the place on the disk where a group of related data is stored.
16. The ______ function is used to create new file/opens an existing file for use.
17. A file name contains _______ and _______ with the extension.
18. The _______ function is used to write a character to a file.
19. getw and putw are _______ functions in file management in C.
20. _______ takes a file pointer and resets the position to the start of the file.
21. The mode _______ is used for opening a file for updating.
22. The function ________ may be used to position a file at the beginning.
23. The function ________ gives the current position in the file.
24. EOF is integer type with the value _______.
25. The function ________ can be used to test for an end of file condition.
26. The functions _______ and _______ perform I/O operations in files.
27. The library function ______ closes a file.
28. Data structure of a file is defined as ______ in the library of standard input, output
function definitions.
29. _______ and _______ are two distinct ways to perform file operations in C.
30. The low level I/O operations uses _______ to perform file operations in C.
31. The process of emptying the buffer by writing its contents to disk is called ______.
32. A ____ is always associated with a file while reading or writing.
33. The process of feeding the output of one program to the input of another program so
that both the programs run simultaneously is called ________.
34. The pointer variable in file operations which indicates the beginning of the buffer
area is often referred to _______.
35. _______ is storage where information is temporarily stored while being transferred
between computer’s memory and data file.
36. The buffer area is established by writing ________.
20
C Programming – Question bank
PART-B
1. What is meant by user-defined data type? Give an example.
2. Differentiate user-defined data types and built-in data types.
3. What are enumeration constants.
4. Define structure with example.
5. Define Union with example.
6. Differentiate structure and union.
7. How is a structure different from an array?
8. Why a structure is called a heterogeneous data type?
9. What is the size of union over structure?
10. Can the name of the fields of two different structures be the same.
11. What are nested structures? and How they are defined?
12. How do we initialize structures during declaration? Give an example.
13. How do we pass a structure as a parameter to functions?
14. Explain the difference between two member access operators in structures.
15. What are bit fields? How are they useful?
16. Can a structure variable be assigned to another? If so, what is the restriction.
17. Can we define a structure within a union?
18. What is the use of typedef in structure?
19. How are arrays of structures defined?
20. What is output of the following code?
main()
{
struct strc{
long int i;
char str[4];
};
struct strc s1;
21
C Programming – Question bank
strc.i=512;
printf(“%d%d%d”, s1.str[0],s1.str[1],s1.str[3]);
}
21. What is meant by self referential structure? Give an example.
22. Differentiate getc(), getchar() and getch().
23. What is meant by random accessing a file?
24. What are the file modes available in C?
25. What is the use of ftell(),fseek() in file handling?
26. Mention the difference between fwrite() and fprintf().
27. Mention the difference between fread() and fscanf().
28. What is meant by command line arguments? Give an example.
29. What is meant by binary files?
30. Differentiate formatted and unformatted file operations.
31. What is meant by macros? and its use.
32. What values are stored in argc() and argv().
33. What are the three steps that are followed while accessing a file?
34. What is the difference between buffered and unbuffered file I/O functions?
35. What are the bitwise operations and operators?
36. How will you open a file?
37. When do we use the following functions? free(), rewind().
38. What is the use of following functions? feof(), ferror().
39. What does the following statement mean?
FILE (*p) (void)
40. What does the following statement mean?
While((c=getchar)!=EOF)
41. What does the following statement mean?
While((m=getw(f1) )!=EOF)
Printf(“%5d”,m);
42. What does the following segment do?
……….
for(i=1;i<=5;i++)
{
fscanf(stdin,”%s”,name);
fprintf(fp,”%s”,name);
}
………..
43. What are the file operations?
44. What is meant by redirection operator in C? How will they use?
45. What is a file? Why is a file called as an external data structure?
46. What are the three steps are followed while accessing a file?
47. Mention two differences between text file and binary file.
48. What are the two possible ways in which a data can be written to a file? Give an
example.
49. List out the possible errors that occur during file handling.
50. Write a program to copy the contents of one file to another file.
22
C Programming – Question bank
PART C
1. Define a structure data type called time_struct containing three members integer
hour, integer minute and integer second. Develop a program that would assign
values to the individual members and display the time in the following form:
16:40:51.
2. Define a structure data type named date containing three integer members day,
month, and year. Develop an interactive modular program to perform the
following tasks
(i) To read the data into structure members by a function.
(ii) To print the date in the format April 29, 2008 by a function.
(iii) To validate the date entered by another function.
3. Write a program to process student record by using structures.
4. Define a structure called CRICKET that contains player name, team name and
batting average. Using cricket, declare an array player with 50 elements and write
a program to read the information about all the 50 players and print a team-wise
list containing names of players with their batting average.
5. Define a structure that can describe a hotel. It should have members that include
name, address, grade, average room charge and number of rooms .Write functions
to perform following operations: (i) To print out hotels of a given grade in order
of charges.
6. Define a structure type, struct personal that would contain person name, date of
joining and salary. Using this structure write a program to read this information
for one person from the keyboard and print the same on the screen.
7. Write a program to illustrate the comparison of structure variables.
8. For a student array write a program to calculate the subject-wise and student-wise
totals and store them as a part of structures.
9. Write a simple program to illustrate the method of sending an entire structure as a
parameter to a function.
10. Write a program for the demonstration of returning structures from functions.
11. Write a program to find a customer record that corresponds to a specified account
number.
12. Write a program to read the 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.
13. A file named DATA contains a series of integer numbers. Code a program to read
these numbers and then write all odd numbers to a file to be called ODD and all
even numbers to a file called EVEN.
14. Write a program to open a file named INVENTORY and store the following data;
item name number price quantity
aaa 111 17.50 100
bbb 222 20.75 150
Extend the program to read this data from the file inventory and display the
inventory table with the value of each item.
15. Write a program to create and count number of characters in a file.
16. Write a program to convert the case of alphabets in a text file. Upper case letters
should be converted to lower case and vice versa.
17. Write a program to illustrate error handling in file operations in C.
23
C Programming – Question bank
18. Write a program that uses the functions ftell() and fseek().
19. Write a program that receive a file name and line of text as command line
arguments and write the text to the file.
20. Write a program that compares two files and returns 0 if they are equal and 1 if
they are not.
21. Write a program that appends one file at the end of another.
22. Write a program that reads a file containing integers and appends at its end the
sum of all the integers.
23. Write a program that reads all numbers from the input file values.dat and stores
the average of these numbers in an output file named as average.res.
24. Write a program which reads a line of characters. Each character entered from the
keyboard is tested to determine its case, and is then written to the data file in the
opposite case.
25. Write a program to illustrate passing structure pointers to functions.
24