Assignment 2_ String & Preprocessors in C
Assignments 2
String
& Preprocessors in C
1) Which function is used to join two strings? Give
syntax.
2) What is macro? Explain the types of macros?
3) Give syntax and use of following functions:
i) strlen ii) strcat iii) strcmp iv) strcpy v) strrev
4) What is the use of strcpy() function in C?
5) Demonstrate puts () function
6) What is macro? Write types of preprocessors in C.
7) What is the use of strncat () function.
8) What is command
line argument? Write properties of command line argument.
9) What is the use of # include directive.
10) Explain in brief concept of macros substitution
directives.
11) What is
string? Hoe to declare string & initialize.
12) Write a ‘C’ program to accept a string & convert
in uppercase without using built - in function.
13) Differentiate macros and functions.
14) Program to concatenate two string in single array.
15) Program to calculate area & circumferences of
circle using macro.
16) Explain any three searching function of string.
17) What is string literals?
18) Which Function are used to read string.
19) Write a ‘C’ program to accept a string & copy
string without using built - in function.
20) What is the output of following C code? Justify.
1) int main ( )
{
static char name [] = “programming”;
char *s ;
s = & name [6]
- 4;
while (*s)
printf (“%c”, * s ++);
}
2)
What is the output of following C code? Justify.
# define Test (x)
(x * x)
int main ( )
{
int a, b = 3;
a = Test (b + 3);
printf (“% d - % d”, a, b);
}
4) #include<stdio.h>
int main()
{
int a =5, b=10, c=7;
predict (a,&b,c);
printf("%d - %d - %d",a,b,c);
}
void predict(int p,int *q,int r)
{
p = 50;
*q =*q * 10;
r = 77;
}
5)
# include<stdio.h>
{
char str[100];
char *ptr;
strcpy(str, “India
is GREAT”);
ptr = str + strlen
(str);
printf (“The
string is:”);
while (*ptr ! =
str)
printf (“%c”, *ptr --);
return 0;
}
Comments
Post a Comment