You are on page 1of 4

1.What are the different functions present in stdio.h?

Explain
Ans.

 Stdio.h stands for Standard Input Output. It has information related


to input/output functions. Some of the functions in stdio.h are
printf, scanf ,getc, putc , etc
 The following is a list of functions found within the <stdio.h>
header file:
Formatted Input/output functions:
fprintf Formatted File Write
fscanf Formatted File Read
printf Formatted Write
scanf Formatted Read
sprintf Formatted String Write
sscanf Formatted String Read
vfprintf Formatted File Write Using Variable Argument List
vprintf Formatted Write Using Variable Argument List
vsprintf Formatted String Write Using Variable Argument List

File Operation functions:


Fclose Close File
fflush Flush File Buffer
fopen Open File
freopen Reopen File
remove Remove File
rename Rename File
setbuf Set Buffer (obsolete)
setvbuf Set Buffer
tmpfile Create Temporary File
tmpnam Generate Temporary File Name

Character Input/output functions:


fgetc Read Character from File
fgets Read String from File
fputc Write Character to File
fputs Write String to File
getc Read Characters from File
getchar Read Character
gets Read String
putc Write Character to File
putchar Write Character
puts Write String
ungetc Unread Character

Block Input/Output functions:


fread Read Block from File
fwrite Write Block to File

File Positioning functions:


fgetpos Get File Position
fseek File Seek
fsetpos Set File Position
ftell Determine File Position
rewind Rewind File
Error Handling functions:
clearerr Clear Stream Error
feof Test for End-of-File
ferror Test for File Error
perror Print Error Message

2.What are the different functions present in conio.h? Explain.


ANS.
 The conio.h header file used in C programming language contains
functions for console input/output. Some of its most commonly
used functions are clrscr, getch, getche, kbhit etc. They can be used
to clear screen, change color of text and background, move text,
check whether a key is pressed or not and to perform other tasks.

 LIST OF INBUILT C FUNCTIONS IN CONIO.H FILE:

Functions Description
clrscr () This function is used to clear the output screen.
getch () It reads character from keyboard
getche () It reads character from keyboard and echoes to
o/p screen
textcolor () This function is used to change the text colour
text background () This function is used to change text background

3. what is the difference between float and double data type?


Ans.
FLOAT DOUBLE
I. Its size is 4 bytes. I. Its size is 8 bytes.
II. Single Precision data-type. II. Double Precision data-type.
III. Format specifier for float data- III. Format specifier for double data-type is
type is %f. %lf.
IV. It has 6 decimal digits precision. IV. It has 15 decimal digits precision.
V. It may get Precision errors V. It will not get precision errors while
while dealing with large dealing with large numbers.
numbers. VI. A value having range within 2.3E-308 to
VI. A value having a range within 1.7E+308 can be assigned to double type
1.2E-38 to 3.4E+38 can be variables.
assigned to float variables.

4. what is the difference between if-else and switch case?


Ans.
IF-ELSE SWITCH CASE
I. The if and else blocks are I. The switch statement has
executed depending on the multiple cases and the code
condition in the if statement. block corresponding to that
II. Used for integer, character, case is executed.
pointer or floating-point type II. Used for character
or Boolean type. expressions and integers.
III. Tests both logical III. Tests only equality.
expressions and equality. IV. Single statements for
IV. Multiple statements for multiple decisions.
multiple decisions. V. If the condition inside switch
V. If the condition inside the statements does not match
if-statement is false, then any of the cases, the default
the code block under the statement is executed.
else condition is executed. VI. The switch case statement
VI. Either the code block in if performs each case until a
statement is executed or the break statement is
code block in else statement. encountered or the end of the
switch statement is reached.

You might also like