New Microsoft Word Document
New Microsoft Word Document
New Microsoft Word Document
the inner printf prints its output and returns length of the string printed on the screen
53. Input:
10,20,30
Output:
60
Arithmetic Operator
Increment/Decrement Operator
Assignment Operator
Relational Operator
Logical Operator
bitwise operator
conditional operator
Division − represents as / operator. And gives the value of the quotient of a division
The '==' operator checks whether the two given operands are equal or not. If so, it returns true
-6/-7 =0
-6/7=0
62. What will be the Output:
-14%3=-2
-14%-3=-2
14%-3=2
(The sign which is assigned to the numerator will be printed in the result )
In the case of a logical OR(||),the second operand does not get evaluated if the first operand is true.
71. What are the Bitwise Operators available in C? Can you describe
them?
—> && bitwise AND
|| bitwise OR
^ bitwise XOR
~ bitwise complimentary
73. Which operator can be used to determine the size of a data type or
variable?
—> sizeof operator
Jump statements
75.Specify different types of Decision control statements?
—> if statement
If else
Else if
Nested if
Switch
90. What is a Global Variable?
The variable that is declared within a function is termed as local variable, while if the variable is
declared outside the function is known as global variable.
91. Suppose a global variable and local variable have the same name.
Is it possible to access a global variable from a block where local
We can access global variable if there is a local variable with same name in C and C++ through
Extern and Scope resolution operator respectively.
Yes, variables belonging to different function can have same name because their scope is limited to
the block in which they are defined. Variables belonging to different functions in a single code can
have same name if we declare that variable globally
Lifetime→ The lifetime of these variables is till the end of the execution of the program.There is no
default value for local variables, so local variables should be declared and an initial value should be
assigned before the first use.
94. List out the differences between Local Variable and Global
Variables?
95. What is an Array?
108. What happens when you attempt to go beyond the range of an array
you read or write outside of an array's bounds, you may read or write garbage or you may get a
segmentation fault which at least tells you there's a problem
109. What happens when you initialize the array values more the
declared size?
It throws garbage values
114What is a Variable length array?Variable length arrays are also known as runtime sized
or variable sized arrays. The size of such arrays is defined at run-time
115. What are Functions?A function is a block of code which only runs when it is
called.Functions are used to perform certain actions, and they are important for reusing code:
Define the code once, and use it many times
.116. What are the different types of functions we have?There are two types of
function in C programming:
User-defined functions
117. What are built-in functions?The system provided these functions and stored them in
the library. Therefore it is also called Library Functions. e.g. scanf(), printf(), strcpy, strlwr, strcmp,
strlen, strcat,
By using functions, we can avoid rewriting same logic/code again and again in a program.
We can call C functions any number of times in a program and from any place in a program.
We can track a large C program easily when it is divided into multiple functions.
123. What are the different ways of passing parameters to the functions?
Which to use when?
There are two ways to pass parameters in C: Pass by Value, Pass by Reference.
Pass by Value. Pass by Value, means that a copy of the data is made and stored by way of the name
of the parameter. ...
Pass by Reference. A reference parameter "refers" to the original data in the calling function.
126.What is the purpose of placing the void keyword within the parameters
of the function?
to indicate that a function takes no arguments. to indicate that a function returns no value.
127.What is a Recursion
Recursion is the technique of making a function call itself.
global variable.
static variable.
automatic variable.
external variable.
130.What is a Static Function?
Static functions in C are functions that are restricted to the same file in which they are defined
Structure members cannot be initialized like other variables inside the structure definition. This is
because when a structure is defined, no memory is allocated to the structure's data members at this
point. Memory is only allocated when a structure variable is declared.
or from a function.
The function will return the value by using the return statement.
The self-referential structure is a structure that points to the same type of structure. It contains one
or more pointers that ultimately point to the same structure.
The -> (arrow) operator is used to access class, structure or union members using a pointer. A postfix
expression, followed by an -> (arrow) operator, followed by a possibly qualified identifier or a
pseudo-destructor name, designates a member of the object to which the pointer points.
In Structure, there is a specific memory location for every input data member. Thus, it can store
multiple values of the various members. In Union, there is an allocation of only one shared memory
for all the input data members. Thus, it stores one value at a time for all of its members.
183. What are enumeration?
Enumeration or Enum in C is a special kind of data type defined by the user. It consists of constant
integrals or integers that are given names by a user. The use of enum in C to name the integer values
makes the entire program easy to learn, understand, and maintain by the same or even different
programmer.
Command-line arguments are simple parameters that are given on the system's command line, and
the values of these arguments are passed on to your program during program execution. When a
program starts execution without user interaction, command-line arguments are used to pass values
or files to it.
#include<stdio.h>
void start()
printf("Hello");