Two Marks For cs3353 With Answer
Two Marks For cs3353 With Answer
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.
The function scanf() is used for formatted input from the standard input and provides many of
the conversion facilities.
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.
The operators that act upon a single operand to produce a new value is known as unary
operator.
Eg: minus operator(-) ,Increment operator (++)
The formal parameters are used to collect values or address from the calling function to a
function being called.
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.
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.
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.
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 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;
}
The function that are predefined and supplied along with the compiler are known as built in
functions. They are also known as library function.
If you declare within a function, It retains the value between function call.
If it is declare a for a function name. It will be visible from other files if the function
declaration is as static.
Static are global variables. By default we can use the global variables from outside files if it is
static global.
Two dimensional array follows row major order storage representation. The elements are
stored in row by row in the subsequent memory locations.
Operator Meaning
& Bitwise AND
| Bitwise OR
<< Shift left
>> Shift right
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
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.
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
+ *& ^ % $ # @ ! ~ ` -- = > < .\ , : ;
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
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
where format specifier string contains certain required formatting information, and avg1,
avg2….avgn are arguments that represent the individual input data item.
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.
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.
Some combination of characters have the special functions such as \n, \t and \b. They are
called as escape sequence.
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’
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;
short
long
signed
unsigned
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
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.
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.
Library function
User – Defined function