1. Define the term variable and constant.
Variable:
A variable is a data name that is used to store a value. A variable may take
different values at different times. A variable can be chosen by the programmer
in a meaningful way. So as to reflect its function or nature in the program.
Eg:
city college
a1
Total_mark
Name Avg
Constant:
A constant is a value that
does not change during the program execution. A constant used in C does not
occupy memory.
2. What
is an expression in C language?
Expression is defined as a
combination of operand and operator to obtain some computation. Operands
represent variable or values and the operator tells what operation is to be
performed.
3. Specify
the use of printf( ) and scanf( ) functions.
v The function
scanf() is used for formatted input from the standard input and provides many
of the conversion facilities.
v It is used for
formatted output to standard output device,( screen) . The format specification
contains string and the data to be output, as the arguments(parameter) to the
printf() function.
4. What
is an unary operator? Give example.
The operators that act upon a single operand to produce a new value is known as
unary operator.
Eg: minus operator(-) ,Increment
operator (++)
5. What
are formal arguments?
The formal parameters are used to collect values or address from the calling
function to a function being called.
6. Define
the term recursion.
A
function may call another function. When a function calls itself, it is
referred to as recursive call the process is known as recursion. C provides
very good facilities for recursion.
7. What
are automatic variable?
Variables that used as a local variable inside any function. This is the
default one. Initial value of variable is garbage value without initialization.
8. What
are bitwise operators?
The bitwise operator performs the operation on bits (i.e, bit by bit). Using
the bitwise operators we can set/ reset/ check any bit in the value of the
variable.
9. Define
the term pointer data type.
A pointer is a variable that represent the location (rather than the value) of
a data item, such as a variable or an array element. It is a variable that
holds a memory address. This address is the location of another variable or an
array element in memory.
10. What are
keywords? Give example.
Keywords have fixed meaning and these meaning cannot be changed. These keywords
can be used only for their intended purpose, they cannot be used as
programmer-defined identifiers.
The following are examples of few
keywords are predefined by C
auto
double
int
struct
break
else
if
switch
case
enum
do
while
11. What is meant
by declaration?
v Declaration is to
represent a variable
v Only variable name
and its data type is represented in declaration.
12. Specify
the syntax used for ‘for’ statement.
The for
loop is entry controlled loop the provides a more concise loop control
structure. The general format of the loop is
for(intilialization;test-condition;increment/decrement) { Body of the loop; } |
13. Mention
the use of ‘break’ and ‘continue’ statements.
v The break statement
is used to terminate the loop containing it.
v The continue
statement does not terminate the entire loop but is used to terminate the
current iteration of the loop.
14. What
are function prototypes?
A function declaration is also
called as function prototype consists of four parts.
· Function
type(return type)
· Function name
· Parameter list
· Terminating
semicolon.
15. What
are library functions?
The function that are predefined
and supplied along with the compiler are known as built in functions. They are
also known as library function.
16. Specify
the role of static variables.
v If you declare
within a function, It retains the value between function call.
v If it is declare a
for a function name. It will be visible from other files if the function
declaration is as static.
v Static are global
variables. By default we can use the global variables from outside files if it
is static global.
17. What
is a string?
A string is a sequence of
characters ending with NULL. It can be treated as a one-dimensional array of
character terminated by a NULL character.
18. How
to declare multidimensional array?
Two
dimensional array follows row major order storage representation. The elements
are stored in row by row in the subsequent memory locations.
19. What
is recursive function? Give an example.
Recursive function is a function
which contains a call to itself.
Eg:
int factorial(int n)
{
if(n==0)
return(1);
else
return(n*factorial(n-1));
}
20. Define
an array.
v Array is the
collection of elements.
v Collection of the
elements of the same data type.
v All elements are
stored in the contiguous memory locations.
21. List any four
bitwise operators.
Operator |
Meaning |
& | << >> |
Bitwise AND Bitwise OR Shift left Shift right |
21. What
are Relational Operator in C?
The
relational operators are used to compare arithmetic, logical and character
expressions. We often compare two similar quantities and depending on their
relation, take some decisions. Each of these operator compares their left hand
side with their right hand side. The whole expression involving the relational
operator then evaluates to an integer. It evaluates to zero if the condition is
false, and one if it is true
Operator |
Meaning |
< |
Less than |
> |
Greater than |
<= |
Less than or equal to |
>= |
Greater than or equal to |
== |
Equal to |
!= |
Not equal to |
22. What
is the purpose of conditional operator?
The
conditional operator consists of two symbols the question mark (?) and the
colon (:). The conditional expression of the form
variable = exp1?exp2:exp3;
conditional
expression
where exp1 is test expression,
exp2 is expression or constant or variable, exp3 is expression or constant or
variable.
23. Write
the advantages of pointer.
Pointer is used in the following
cases.
· It is used to
access array elements.
· It is used for
dynamic memory allocation.
· It is used in call
by reference.
· It is used in data
structure like trees, graph, etc.
24. What
is character set?
The C Character set
consists of upper and lower case alphabets, digits, special character and white
spaces. The alphabet and digits are together called the alphanumeric
characters.
· Alphabets:
A,B,C,D,E………………………X,Y,Z
a,b,c,d,e………………………..x,y,z
· Digits:
0,1,2,3,4,5,6,7,8,9
· Special Character
+ *&
^ % $ # @ ! ~ ` -- = > < .\ , : ;
25. What
are logical operators?
A logical operator is used to compare or evaluate logical and relational
expressions. There three logical in C language. They are
Operator |
Meaning |
&& |
AND |
|| |
OR |
! |
NOT |
26. Write
a note on scanf() function.
The
scanf() function can be used to enter any combination of data, like single
character, string, integer and float values. The general format of the scanf()
function is
scanf(“format specifier “, arg1, arg2……………..argn); |
where format specifier string
contains certain required formatting information, and avg1, avg2….avgn are
arguments that represent the individual input data item.
27. What
are function?
A function is a set of statement to perform a specific task.
28. Define
actual parameters.
Actual parameters are used for passing values or address from the calling
function to a function being called.
29. Write
the general form of structure of C functions.
A C program basically has the following form
o pre-processor
commands
o type
definitions
o function
prototype
o variable
declaration
o function
body
30. Give
the syntax of if-else statement.
The if-else statement performs
one of the two possible actions. The general format is
if(test expression) { true-statement block; } else { false-statement block; } next statement. |
31. What
is an identifier?
Identifier are names that
are given to various program elements such as variables, functions and arrays.
Identifier consist of letters and digits, in any order, except that the first
character must be a letter. Both upper and lower case letters are permitted
though common usage favours the use of lower letters. The underscore is treated
as a letter.
32. What
is an escape sequence?
Some combination of characters have the special functions such as \n, \t and
\b. They are called as escape sequence.
33. What
is the purpose of getchar() function?
It returns a character
just entered from the standard input unit that is keyboard. The entered
character can be either assigned to a character variable or enclosed to the
computer screen.
34. What
is a character constant?
A character constant is a single
character, enclosed within the pair of single quotation mark. Example
: ‘x’ , ‘5’
35. What
is purpose of comma operator?
A set of expression separated by commas is a valid construct in the C language.
For example
int i,j;
The comma operator also used to link the related expression together. A comma
linked list of expression are evaluated left to right and the value of
right-most expression is the value of the combined expressions.
36. What
is use of gets( ) function?
The
gets( ) function is used to accept a string.
37. How
to declare pointer variable?
A pointer declaration consists of a base type, an *, and the variable name. The
general form for declaring a pointer variable is
data_type *var_name;
For example
int *p;
38. List
the four types of qualifiers.
· short
· long
· signed
· unsigned
39. What
is an operator?
In C operator can be classified into various categories based on their utility
and action, a list operator types are given below
· Arithmetic
operators
· Relational
operators
· Logical operators
· Assignment
operators
· Increment operators
· Conditional
operators
· Bitwise operators
· Comma operators
· Other operators
40. What
are the advantages of functions?
v It reduces the
complexity in a program by reducing the code.
v Functions are
easily understandable and execution is faster.
v It also reduces the
time to run a program.
v It’s easy to
find-out the errors due to the blocks made as function definition outside the
main function.
41. Write
the syntax of while statement in C.
The general format of the while statement is
while(test_condition) { Body of the
loop; } |
42. What
is symbolic constant (pre-processor constant)?
v Names given to
value that cannot be changed.
v Implemented with
the #define program directive
#define N 300
v Note that
pre-processor statement begin with a # symbol, and semicolon before the program
is actually compiled.
v In general,
pre-processor constant are written in ‘UPPER CASE’.
43. What
is a looping?
A looping is a process to do a job repeatedly with possible different data at
each time. The statement executed each time constitute the loop body, and each
pass is called iteration. A condition must be present to terminate the loop.
44. What
is string constant?
A string constant is a sequence of character enclosed in double quotes. The
characters may be letters, numbers, special characters and blank space.
Eg: “Hello” ”1987” “WELL DONE” “?.....!” “5+3” “X”
45. What
is the purpose of putchar( ) function?
The putchar( ) function display one character on the display monitor. The
character to be displayed is of type char. The syntax for putchar( ) function
is as given below
putchar(variable);
46. Write
a note on do-while statement.
In the do statement, the program proceeds to executes the body of the loop
first. At the end of the loop the test condition is evaluated. If the condition
is true, the program continues to execute the body of the loop. This process
continues as long as the condition is true.
47. Define
scope of variables.
Scope refers to the visibility of variables of it is declared outside of any
function declaration, it is a global variable. If it is declared inside of any
function declaration, it is a local variable.
48. Write
the syntax for switch() statement.
switch(expression) { case value-1:
Block-1;
Block-2; …………. …………. default:
default block;
break; } statement-x; |
49. What
are register variable?
v Variables are used
as a local variable.
v May be stored in
register if possible.
v Default initial
value is garbage value.
50. Mention
the two categories of function
· Library function
· User – Defined function
51. What
is a file?
A file is a place on the disk where a group of related data is stored.
No comments:
Post a Comment