You are on page 1of 4

1.

Convert the following if statement into conditional expression using ternary


operator
if(a>b)
big = a;
else big = b;
ANS:
big = (a>b)? a : b;
2. Give syntax for ternary operator
Syntax: condition? exp1:exp2;
Conditional or ternary operator itself checks the condition and executes the
statements depending on the condition.
? act as ternary operator.
It evaluates the condition if true then exp 1 is evaluated. If else then exp2 is
evaluated.
E.g.: main()
{ int a=5,b=3,big; big= (a>b)? a : b; printf(Big is %d,big); }
3. Give the meaning of following function.
Floor(d)- Return a value rounded down to the next lower integer.
Fmod(d1,d2)- Return the remainder of d1/d2.
Pow(d1,d2)- Return d1 raised to d2 power.
Ceil(d)- Return a value rounded up to the next higher integer.
4. What are the types of I/O statements available in C?
There are two types of I/O statements available in C
a) Formatted I/O statements
b) Unformatted I/O statements
5. Define array & its features.
An array is a collection of similar data items that are stored under a common
name.
An array is a derived data type. It is used to represent a collection of elements of
the same data type. The element can be accessed with base address & the
subscripts define the position of the element. In array the elements are stored in
continuous memory allocation. It is easier to refer the array elements by simply
incrementing the value of subscript.
6.

7.

Explain Two dimensional array.


Two dimensional array can be defined in the same fasion as in one
dimensional array expect a separate pair of square brackets are required for each
subscript.
Syntax: Datatype arrayname[rows][column];
Write the classification of array.
One-dimensional array
Two-dimensional array
Multi-dimensional array

8. How strings are represented in language C?/ what is meant by string manipulation?

In C Language the group of character, digit, and symbols enclosed with in


quotation mark are called string. Null character is used to mark the end of the
string. Char name[]=Kongunadu;
9.

Define strcpy() function.


This function is used to copy the contents of one string to another and it
almost works like string assignment operator.

10.

Define strlen() & strcat() function.


This function is used to count and return the number of characters present in
a string. Strcat() is used to concatenate or combine two strings together and form a
new concatenated string.

11.

Explain one dimensional array.


The collection of data item can be stored under a one variable name using
only one subscript such a variable is called one dimensional array.
Syntax: Datatype arrayname[size];
12. Define function.
A function is a set of instructions that are used to perform specified tasks which
repeatedly occurs in the main program.
13. What is user defined function & its elements?
The function defined by the users according to their requirements is
called user defined functions. The users can modify the function according to their
requirements.
Function definition
Function declaration
Function call
14. Define local and global variables.
The local variables are defined within the body of the function or the block.
The global variables are defined outside the main() function.
15. What is recursion?
It is the process of calling the same function itself again and again until some
condition is satisfied.
16. What is a pointer?
A pointer is a variable contain the memory address of the another variable.
17.

Writ a example program to access a variable through its pointer.


int a=22, *a;
a=&a;
printf(the value of A is %d:,*a);
18. Is it possible to refer the elements of an array by using pointer notation? If so
means give an example
int *a[3];
int b=5,c=10, d=15, i;
a[1]=&c;
a[2]=&d;
for (i=0;i<3;i++)
printf(%u,a[i]);

19. Give any 4 features of pointers.


Pointers are efficient in handling data and associated with array.
Pointer is used for saving memory space.
Pointer reduces length and complexity of the program.
Use of pointer assigns the memory space and also releases it.

20.
21.
22.
23.

What is null pointer?


A pointer is said to be a null pointer when its right value is 0.

What are the advantages of pointer?


a. Pointers are more compact & efficient code.
b. It can be used to achieve clarity & simplicity.
c. It enables us to access the memory directly
24.
Write syntax for pointer to structure.
25.
Pointer pointing to a structure is known as structures
pointers.
26.
Struct
27.
{
28.
Member 1;
29.
Member 2;
30.
}var,*ptr;
31.
Where var represents structure type variable.
32.
*ptr represents name of the pointer.
23 What are the operators exclusively used with pointers?
33.
& - it represents the address of the variable
34.
*- it represents the value of the variable.
24 Define parameter & its types.
35. Parameter provides the data communication between
calling function & called function. There are two types of
parameters
a. Actual parameter- It is transferred from calling program into
called program (main to function).
b. Formal parameter- It is transferred into calling program from
called program (function to main).
25 Define return statement.
36. The return statement may or may not send back any
values to the main program. Syntax: return or return(exp);
26 Define function prototype & its types.
37.
The function prototype declaration consists of function
return type, name & argument list . it is always terminated with
semi colon(;).
38. The types are
a. Function without arguments & without return value
b. Function without arguments & with return value
c. Function with arguments & without return value
d. Function with arguments & with return value
27 Define Pointer arithmetic or pointer expression.
39. Pointer variable can be used in expression. The pointers
are presided by in directional operator. Eg c=*a+*b-c=(*a)+
(*b) .
40.

You might also like