Font size
WorksheetsUntitled Quiz
Total questions: 20
Worksheet time: 11mins
List the categories of user defined function.
1. Function with no arguments and no return type.
2. Function with no arguments and a return type.
3. Function with arguments and no return type.
4. Function with arguments and with return type.
Any two string handling function.
strcpy( str1, str2)
strcmd()
strcpy()
strcmp(str1, str2)
#include<stdio.h>
#include<math.h>
int main() {
float n, ceilVal;
printf(" Enter any S-23 4M Numeric element : ");
scanf("%f", &n);
ceilVal = ceil(n);
printf("\n The Value of %.2f = %.4f ", n, ceilVal);
return 0;
}
IN ABOVE CODE WHICH MATH FUNCTION IS USE...?
sqrt ()
POW()
ceil()
strlen()
Fibonacci series sequence....?
0 1 2 3 4 5 6 7
0 1 1 2 3 5 8 13
2 3 4 5 6 7 8 8
0 1 1 2 3 3 4 8 13
State any two advantages of function.?
1) Big code can be diffict to read, so when divided into smaller functions, it increases readability.
2 2) Program becomes modul.
1) Big code can be difficult to read, so when divided into smaller functions, it increases readability.
2) Program becomes modular.
1) Big code can be difficult to read, so when divi nto smaller functions, it increases readbty.
2) Program becomes moalr.
1) Big code can be difficult to re, so when divided into smler func, it increases readability. 2) Program bemes modular.
When function is called by passing values then it is _____?
call by reference
call by function
call by pointer
call by value
No copy is generated for actual variable rather address of actual variable is passed.
call by pointer
Call by value
call by function
Call by reference
Copy of actual variable is created when function is called.
Call by reference
call by pointer
call by function
Call by value
Example:-
Function call - Swap ( x,y);
strlen()
strcpy()
Call by reference
Call by value
Original (actual) parameters do not change.
strcpy()
strlen()
Call by value
ceil()
Function call – Swap ( &x, &y );
strcmd()
call by value
strlen()
Call by reference
Actual parameters change as function
call by value
sqrt()
call by reference
ceil()
Syntax: strlen(str);
Used to copy two strings
Used to join two strings
Used to find length of the string
Used to override two strings
Syntax: strcat(str1, str2);
Used to find the string
Used to find length of the string
Used to copy length of the string
Used to join two strings
recursion two advantages.
1.Reduces string of the program
2.Reduces unnecessary functions
1.Reduces program output
2.Reduces unnecessary data.
1.Reduces length of the program
2.Reduces unnecessary calling of a function
1.Used to find length of the string
2.Used to join two strings
It is function from stdio.h header file. This function is used to input a single character. The enter key is pressed which is followed by the character that is typed. The character that is entered is echoed.
putchar( ) ;
char( ) ;
getchar( ) ;
arr( ) ;
A function that calls itself repeatedly, either directly or indirectly, until it reaches its base case is known as a____
pointer function
recursive function
reccurrsive function
string function
The name "malloc" stands for____
memory Read.
memory deallocation.
memory allocation.
memory write.
The name "calloc" stands for___
datatype allocation.
contiguous allocation.
memory allocation.
space allocation.
#include<stdio.h>
#include<conio.h>
void findReverse();
void main()
{
findReverse();
}
void findReverse()
{
int num, res=0,ans=0;
clrscr();
printf("Enter the number");
scanf("%d", &num);
while(num!=0) {
res=num%10;
ans=ans*10+res;
num=num/10;
}
printf("Reverse number is %d", ans);
getch();
}
code of reverse the pointer
code of reverse the string
code of reverse the number
code of reverse the function
