SlideShare a Scribd company logo
What is a pointer on pointer?
It’s a pointer variable which can hold the address of another pointer variable. It de-refers twice to
point to the data held by the designated pointer variable.
Eg: int x = 5, *p=&x, **q=&p;
Therefore ‘x’ can be accessed by **q.
Distinguish between malloc() & calloc() memory allocation.
Both allocates memory from heap area/dynamic memory. By default calloc fills the allocated
memory with 0’s.
What is keyword auto for?
By default every local variable of the function is automatic (auto). In the below function both the
variables ‘i’ and ‘j’ are automatic variables.
void f() {
int i;
auto int j;
}
NOTE − A global variable can’t be an automatic variable.
What are the valid places for the keyword break to appear.
Break can appear only with in the looping control and switch statement. The purpose of the break
is to bring the control out from the said blocks.
Explain the syntax for for loop.
for(expression-1;expression-2;expression-3) {
//set of statements
}
When control reaches for expression-1 is executed first. Then following expression-2, and if
expression-2 evaluates to non-zero ‘set of statements’ and expression-3 is executed, follows
expression-2.
What is difference between including the header file with-in angular braces < > and double
quotes “ “
If a header file is included with in < > then the compiler searches for the particular header file
only with in the built in include path. If a header file is included with in “ “, then the compiler
searches for the particular header file first in the current working directory, if not found then in
the built in include path.
How a negative integer is stored. What is a static variable?
A static local variables retains its value between the function call and the default value is 0. The
following function will print 1 2 3 if called thrice.
void f() {
static int i;
++i;
printf(“%d “,i);
}
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
If a global variable is static then its visibility is limited to the same source code.
What is a NULL pointer?
A pointer pointing to nothing is called so. Eg: char *p=NULL;
What is the purpose of extern storage specifier?
Used to resolve the scope of global symbol.
Eg:
main() {
extern int i;
Printf(“%d”,i);
}
int i = 20;
Explain the purpose of the function sprintf().
Prints the formatted output onto the character array.
What is the meaning of base address of the array?
The starting address of the array is called as the base address of the array.
When should we use the register storage specifier?
If a variable is used most frequently then it should be declared using register storage specifier,
then possibly the compiler gives CPU register for its storage to speed up the look up of the
variable.
S++ or S = S+1, which can be recommended to increment the value by 1 and why?
S++, as it is single machine instruction (INC) internally.
What is a dangling pointer?
A pointer initially holding valid address, but later the held address is released or freed. Then such
a pointer is called as dangling pointer.
What is the purpose of the keyword typedef?
It is used to alias the existing type. Also used to simplify the complex declaration of the type.
What is lvalue and rvalue?
The expression appearing on right side of the assignment operator is called as rvalue. Rvalue is
assigned to lvalue, which appears on left side of the assignment operator. The lvalue should
designate to a variable not a constant.
What is the difference between actual and formal parameters?
The parameters sent to the function at calling end are called as actual parameters while at the
receiving of the function definition called as formal parameters.
Can a program be compiled without main() function?
Yes, it can be but cannot be executed, as the execution requires main() function definition.
What is the advantage of declaring void pointers?
When we do not know what type of the memory address the pointer variable is going to hold,
then we declare a void pointer for such.
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
Where an automatic variable is stored?
Every local variable by default being an auto variable is stored in stack memory.
What is a nested structure?
A structure containing an element of another structure as its member is referred so.
What is the difference between variable declaration and variable definition?
Declaration associates type to the variable whereas definition gives the value to the variable.
What is a self-referential structure?
A structure containing the same structure pointer variable as its element is called as self-
referential structure.
Does a built-in header file contains built-in function definition?
No, the header file only declares function. The definition is in library which is linked by the
linker.
Explain modular programming.
Dividing the program in to sub programs (modules/function) to achieve the given task is modular
approach. More generic functions definition gives the ability to re-use the functions, such as
built-in library functions.
What is a token?
A C program consists of various tokens and a token is either a keyword, an identifier, a constant,
a string literal, or a symbol.
What is a preprocessor?
Preprocessor is a directive to the compiler to perform certain things before the actual compilation
process begins.
Explain the use of %i format specifier w.r.t scanf().
Can be used to input integer in all the supported format.
How can you print a  (backslash) using any of the printf() family of functions.
Escape it using  (backslash).
Does a break is required by default case in switch statement?
Yes, if it is not appearing as the last case and if we do not want the control to flow to the
following case after default if any.
When to user -> (arrow) operator.
If the structure/union variable is a pointer variable, to access structure/union elements the arrow
operator is used.
What are bit fields?
We can create integer structure members of differing size apart from non-standard size using bit
fields. Such structure size is automatically adjusted with the multiple of integer size of the
machine.
What are command line arguments?
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
The arguments which we pass to the main() function while executing the program are called as
command line arguments. The parameters are always strings held in the second argument (below
in args) of the function which is array of character pointers. First argument represents the count
of arguments (below in count) and updated automatically by operating system.
main( int count, char *args[]) {
}
What are the different ways of passing parameters to the functions? Which to use when?
 Call by value − We send only values to the function as parameters. We choose this if we
do not want the actual parameters to be modified with formal parameters but just used.
 Call by reference − We send address of the actual parameters instead of values. We
choose this if we do want the actual parameters to be modified with formal parameters.
What is the purpose of built-in stricmp() function.
It compares two strings by ignoring the case.
Describe the file opening mode “w+”.
Opens a file both for reading and writing. If a file is not existing it creates one, else if the file is
existing it will be over written.
Where the address of operator (&) cannot be used?
It cannot be used on constants.
It cannot be used on variable which are declared using register storage class.
Is FILE a built-in data type?
No, it is a structure defined in stdio.h.
What is reminder for 5.0 % 2?
Error, It is invalid that either of the operands for the modulus operator (%) is a real number.
How many operators are there under the category of ternary operators?
There is only one operator and is conditional operator (? : ).
Which key word is used to perform unconditional branching?
goto
What is a pointer to a function? Give the general syntax for the same.
A pointer holding the reference of the function is called pointer to a function. In general it is
declared as follows.
T (*fun_ptr) (T1,T2…); Where T is any date type.
Once fun_ptr refers a function the same can be invoked using the pointer as follows.
fun_ptr();
[Or]
(*fun_ptr)();
Explain the use of comma operator (,).
Comma operator can be used to separate two or more expressions.
Eg: printf(“hi”) , printf(“Hello”);
What is a NULL statement?
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
A null statement is no executable statements such as ; (semicolon).
Eg: int count = 0;
while( ++count<=10 ) ;
Above does nothing 10 times.
What is a static function?
A function’s definition prefixed with static keyword is called as a static function. You would
make a function static if it should be called only within the same source code.
Which compiler switch to be used for compiling the programs using math library with gcc
compiler?
Opiton –lm to be used as > gcc –lm <file.c>
Which operator is used to continue the definition of macro in the next line?
Backward slash () is used.
E.g. #define MESSAGE "Hi, 
Welcome to C"
Which operator is used to receive the variable number of arguments for a function?
Ellipses (…) is used for the same. A general function definition looks as follows
void f(int k,…) {
}
What is the problem with the following coding snippet?
char *s1 = "hello",*s2 = "welcome";
strcat(s1,s2);
s1 points to a string constant and cannot be altered.
Which built-in library function can be used to re-size the allocated dynamic memory?
realloc().
Define an array.
Array is collection of similar data items under a common name.
What are enumerations?
Enumerations are list of integer constants with name. Enumerators are defined with the keyword
enum.
Which built-in function can be used to move the file pointer internally?
fseek()
What is a variable?
A variable is the name storage.
Who designed C programming language?
Dennis M Ritchie.
C is successor of which programming language?
B
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
What is the full form of ANSI?
American National Standards Institute.
Which operator can be used to determine the size of a data type or variable?
sizeof
Can we assign a float variable to a long integer variable?
Yes, with loss of fractional part.
Is 068 a valid octal number?
No, it contains invalid octal digits.
What it the return value of a relational operator if it returns any?
Return a value 1 if the relation between the expressions is true, else 0.
How does bitwise operator XOR works.
If both the corresponding bits are same it gives 0 else 1.
What is an infinite loop?
A loop executing repeatedly as the loop-expression always evaluates to true such as
while(0 == 0) {
}
Can variables belonging to different scope have same name? If so show an example.
Variables belonging to different scope can have same name as in the following code snippet.
int var;
void f() {
int var;
}
main() {
int var;
}
What is the default value of local and global variables?
Local variables get garbage value and global variables get a value 0 by default.
Can a pointer access the array?
Pointer by holding array’s base address can access the array.
What are valid operations on pointers?
The only two permitted operations on pointers are
 Comparision ii) Addition/Substraction (excluding void pointers)
What is a string length?
It is the count of character excluding the ‘0’ character.
What is the built-in function to append one string to another?
strcat() form the header string.h
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
Which operator can be used to access union elements if union variable is a pointer
variable?
Arrow (->) operator.
Explain about ‘stdin’.
stdin in a pointer variable which is by default opened for standard input device.
Name a function which can be used to close the file stream.
fclose().
What is the purpose of #undef preprocessor?
It be used to undefine an existing macro definition.
Define a structure.
A structure can be defined of collection of heterogeneous data items.
Name the predefined macro which be used to determine whether your compiler is ANSI standard
or not?
__STDC__
What is typecasting?
Typecasting is a way to convert a variable/constant from one type to another type.
What is recursion?
Function calling itself is called as recursion.
Which function can be used to release the dynamic allocated memory?
free().
What is the first string in the argument vector w.r.t command line arguments?
Program name.
How can we determine whether a file is successfully opened or not using fopen() function?
On failure fopen() returns NULL, otherwise opened successfully.
What is the output file generated by the linker.
Linker generates the executable file.
What is the maximum length of an identifier?
Ideally it is 32 characters and also implementation dependent.
What is the default function call method?
By default the functions are called by value.
Functions must and should be declared. Comment on this.
Function declaration is optional if the same is invoked after its definition.
When the macros gets expanded?
At the time of preprocessing.
Can a function return multiple values to the caller using return reserved word?
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
No, only one value can be returned to the caller.
What is a constant pointer?
A pointer which is not allowed to be altered to hold another address after it is holding one.
To make pointer generic for which date type it need to be declared?
Void
Can the structure variable be initialized as soon as it is declared?
Yes, w.r.t the order of structure elements only.
Is there a way to compare two structure variables?
There is no such. We need to compare element by element of the structure variables.
Which built-in library function can be used to match a patter from the string?
Strstr()
What is difference between far and near pointers?
In first place they are non-standard keywords. A near pointer can access only 2^15 memory
space and far pointer can access 2^32 memory space. Both the keywords are implementation
specific and are non-standard.
Can we nest comments in a C code?
No, we cannot.
Which control loop is recommended if you have to execute set of statements for fixed
number of times?
for – Loop.
What is a constant?
A value which cannot be modified is called so. Such variables are qualified with the keyword
const.
Can we use just the tag name of structures to declare the variables for the same?
No, we need to use both the keyword ‘struct’ and the tag name.
Can the main() function left empty?
Yes, possibly the program doing nothing.
Can one function call another?
Yes, any user defined function can call any function.
Apart from Dennis Ritchie who the other person who contributed in design of C language.
Brain Kernighan
Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
Ad

More Related Content

What's hot (19)

Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Python Session - 4
Python Session - 4Python Session - 4
Python Session - 4
AnirudhaGaikwad4
 
Computer programming(CP)
Computer programming(CP)Computer programming(CP)
Computer programming(CP)
nmahi96
 
Notes part 8
Notes part 8Notes part 8
Notes part 8
Keroles karam khalil
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
Dennis Chang
 
Strings-Computer programming
Strings-Computer programmingStrings-Computer programming
Strings-Computer programming
nmahi96
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
 
Definitions of Functional Programming
Definitions of Functional ProgrammingDefinitions of Functional Programming
Definitions of Functional Programming
Philip Schwarz
 
Savitch Ch 17
Savitch Ch 17Savitch Ch 17
Savitch Ch 17
Terry Yoast
 
C programming session3
C programming  session3C programming  session3
C programming session3
Keroles karam khalil
 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp
sharvivek
 
Python second ppt
Python second pptPython second ppt
Python second ppt
RaginiJain21
 
Glimpses of C++0x
Glimpses of C++0xGlimpses of C++0x
Glimpses of C++0x
ppd1961
 
C language ppt
C language pptC language ppt
C language ppt
Ğäùråv Júñêjå
 
Programming in C Session 1
Programming in C Session 1Programming in C Session 1
Programming in C Session 1
Prerna Sharma
 
Ch06
Ch06Ch06
Ch06
Arriz San Juan
 
Control Structures in Python
Control Structures in PythonControl Structures in Python
Control Structures in Python
Sumit Satam
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
Appili Vamsi Krishna
 
Savitch ch 17
Savitch ch 17Savitch ch 17
Savitch ch 17
Terry Yoast
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Computer programming(CP)
Computer programming(CP)Computer programming(CP)
Computer programming(CP)
nmahi96
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
Dennis Chang
 
Strings-Computer programming
Strings-Computer programmingStrings-Computer programming
Strings-Computer programming
nmahi96
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
 
Definitions of Functional Programming
Definitions of Functional ProgrammingDefinitions of Functional Programming
Definitions of Functional Programming
Philip Schwarz
 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp
sharvivek
 
Glimpses of C++0x
Glimpses of C++0xGlimpses of C++0x
Glimpses of C++0x
ppd1961
 
Programming in C Session 1
Programming in C Session 1Programming in C Session 1
Programming in C Session 1
Prerna Sharma
 
Control Structures in Python
Control Structures in PythonControl Structures in Python
Control Structures in Python
Sumit Satam
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
Appili Vamsi Krishna
 

Similar to C interview questions (20)

Function in C++
Function in C++Function in C++
Function in C++
Prof Ansari
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
Manas40552
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
Praveen M Jigajinni
 
Introduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John LadoIntroduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John Lado
Mark John Lado, MIT
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
AMAN ANAND
 
Learn more about the concepts Functions of Python
Learn more about the concepts Functions of PythonLearn more about the concepts Functions of Python
Learn more about the concepts Functions of Python
PrathamKandari
 
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
All chapters C++ - Copy.pdfytttttttttttttttttttttttttttttAll chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
jacobdiriba
 
C functions list
C functions listC functions list
C functions list
Thesis Scientist Private Limited
 
What is storage class
What is storage classWhat is storage class
What is storage class
Isha Aggarwal
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
Deepak Singh
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
Krushal Kakadia
 
interview questions.docx
interview questions.docxinterview questions.docx
interview questions.docx
SeoTechnoscripts
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
home
 
What is c language
What is c languageWhat is c language
What is c language
Kushaal Singla
 
[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++
Muhammad Hammad Waseem
 
Functions in c
Functions in cFunctions in c
Functions in c
SunithaVesalpu
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
Pranali Chaudhari
 
9 functions.pptxFunction that are used in
9 functions.pptxFunction that are used in9 functions.pptxFunction that are used in
9 functions.pptxFunction that are used in
divyamth2019
 
C interview question answer 1
C interview question answer 1C interview question answer 1
C interview question answer 1
Amit Kapoor
 
qb unit2 solve eem201.pdf
qb unit2 solve eem201.pdfqb unit2 solve eem201.pdf
qb unit2 solve eem201.pdf
Yashsharma304389
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
Manas40552
 
Introduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John LadoIntroduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John Lado
Mark John Lado, MIT
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
AMAN ANAND
 
Learn more about the concepts Functions of Python
Learn more about the concepts Functions of PythonLearn more about the concepts Functions of Python
Learn more about the concepts Functions of Python
PrathamKandari
 
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
All chapters C++ - Copy.pdfytttttttttttttttttttttttttttttAll chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
All chapters C++ - Copy.pdfyttttttttttttttttttttttttttttt
jacobdiriba
 
What is storage class
What is storage classWhat is storage class
What is storage class
Isha Aggarwal
 
Chapter 11 Function
Chapter 11 FunctionChapter 11 Function
Chapter 11 Function
Deepak Singh
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
home
 
9 functions.pptxFunction that are used in
9 functions.pptxFunction that are used in9 functions.pptxFunction that are used in
9 functions.pptxFunction that are used in
divyamth2019
 
C interview question answer 1
C interview question answer 1C interview question answer 1
C interview question answer 1
Amit Kapoor
 
Ad

More from Kuntal Bhowmick (20)

Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loopsMultiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Kuntal Bhowmick
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Kuntal Bhowmick
 
1. introduction to E-commerce
1. introduction to E-commerce1. introduction to E-commerce
1. introduction to E-commerce
Kuntal Bhowmick
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
Kuntal Bhowmick
 
DBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental conceptsDBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental concepts
Kuntal Bhowmick
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
Kuntal Bhowmick
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
Kuntal Bhowmick
 
Operating system Interview Questions
Operating system Interview QuestionsOperating system Interview Questions
Operating system Interview Questions
Kuntal Bhowmick
 
Computer Network Interview Questions
Computer Network Interview QuestionsComputer Network Interview Questions
Computer Network Interview Questions
Kuntal Bhowmick
 
C question
C questionC question
C question
Kuntal Bhowmick
 
Distributed operating systems cs704 a class test
Distributed operating systems cs704 a class testDistributed operating systems cs704 a class test
Distributed operating systems cs704 a class test
Kuntal Bhowmick
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
Kuntal Bhowmick
 
CS291(C Programming) assignment
CS291(C Programming) assignmentCS291(C Programming) assignment
CS291(C Programming) assignment
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 8 -- int...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Multiple Choice Questions on JAVA (object oriented programming) bank 7 -- abs...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Multiple Choice Questions on JAVA (object oriented programming) bank 6 -- inh...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Multiple Choice Questions on JAVA (object oriented programming) bank 5 -- mem...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loopsMultiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Multiple Choice Questions on JAVA (object oriented programming) bank 4 -- loops
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Multiple Choice Questions on JAVA (object oriented programming) bank 3 -- cla...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Multiple Choice Questions on JAVA (object oriented programming) bank 2 -- bas...
Kuntal Bhowmick
 
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Multiple Choice Questions on JAVA (object oriented programming) bank 1 -- int...
Kuntal Bhowmick
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Kuntal Bhowmick
 
1. introduction to E-commerce
1. introduction to E-commerce1. introduction to E-commerce
1. introduction to E-commerce
Kuntal Bhowmick
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
Kuntal Bhowmick
 
DBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental conceptsDBMS and Rdbms fundamental concepts
DBMS and Rdbms fundamental concepts
Kuntal Bhowmick
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
Kuntal Bhowmick
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
Kuntal Bhowmick
 
Operating system Interview Questions
Operating system Interview QuestionsOperating system Interview Questions
Operating system Interview Questions
Kuntal Bhowmick
 
Computer Network Interview Questions
Computer Network Interview QuestionsComputer Network Interview Questions
Computer Network Interview Questions
Kuntal Bhowmick
 
Distributed operating systems cs704 a class test
Distributed operating systems cs704 a class testDistributed operating systems cs704 a class test
Distributed operating systems cs704 a class test
Kuntal Bhowmick
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
Kuntal Bhowmick
 
CS291(C Programming) assignment
CS291(C Programming) assignmentCS291(C Programming) assignment
CS291(C Programming) assignment
Kuntal Bhowmick
 
Ad

Recently uploaded (20)

Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 

C interview questions

  • 1. What is a pointer on pointer? It’s a pointer variable which can hold the address of another pointer variable. It de-refers twice to point to the data held by the designated pointer variable. Eg: int x = 5, *p=&x, **q=&p; Therefore ‘x’ can be accessed by **q. Distinguish between malloc() & calloc() memory allocation. Both allocates memory from heap area/dynamic memory. By default calloc fills the allocated memory with 0’s. What is keyword auto for? By default every local variable of the function is automatic (auto). In the below function both the variables ‘i’ and ‘j’ are automatic variables. void f() { int i; auto int j; } NOTE − A global variable can’t be an automatic variable. What are the valid places for the keyword break to appear. Break can appear only with in the looping control and switch statement. The purpose of the break is to bring the control out from the said blocks. Explain the syntax for for loop. for(expression-1;expression-2;expression-3) { //set of statements } When control reaches for expression-1 is executed first. Then following expression-2, and if expression-2 evaluates to non-zero ‘set of statements’ and expression-3 is executed, follows expression-2. What is difference between including the header file with-in angular braces < > and double quotes “ “ If a header file is included with in < > then the compiler searches for the particular header file only with in the built in include path. If a header file is included with in “ “, then the compiler searches for the particular header file first in the current working directory, if not found then in the built in include path. How a negative integer is stored. What is a static variable? A static local variables retains its value between the function call and the default value is 0. The following function will print 1 2 3 if called thrice. void f() { static int i; ++i; printf(“%d “,i); } Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 2. If a global variable is static then its visibility is limited to the same source code. What is a NULL pointer? A pointer pointing to nothing is called so. Eg: char *p=NULL; What is the purpose of extern storage specifier? Used to resolve the scope of global symbol. Eg: main() { extern int i; Printf(“%d”,i); } int i = 20; Explain the purpose of the function sprintf(). Prints the formatted output onto the character array. What is the meaning of base address of the array? The starting address of the array is called as the base address of the array. When should we use the register storage specifier? If a variable is used most frequently then it should be declared using register storage specifier, then possibly the compiler gives CPU register for its storage to speed up the look up of the variable. S++ or S = S+1, which can be recommended to increment the value by 1 and why? S++, as it is single machine instruction (INC) internally. What is a dangling pointer? A pointer initially holding valid address, but later the held address is released or freed. Then such a pointer is called as dangling pointer. What is the purpose of the keyword typedef? It is used to alias the existing type. Also used to simplify the complex declaration of the type. What is lvalue and rvalue? The expression appearing on right side of the assignment operator is called as rvalue. Rvalue is assigned to lvalue, which appears on left side of the assignment operator. The lvalue should designate to a variable not a constant. What is the difference between actual and formal parameters? The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters. Can a program be compiled without main() function? Yes, it can be but cannot be executed, as the execution requires main() function definition. What is the advantage of declaring void pointers? When we do not know what type of the memory address the pointer variable is going to hold, then we declare a void pointer for such. Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 3. Where an automatic variable is stored? Every local variable by default being an auto variable is stored in stack memory. What is a nested structure? A structure containing an element of another structure as its member is referred so. What is the difference between variable declaration and variable definition? Declaration associates type to the variable whereas definition gives the value to the variable. What is a self-referential structure? A structure containing the same structure pointer variable as its element is called as self- referential structure. Does a built-in header file contains built-in function definition? No, the header file only declares function. The definition is in library which is linked by the linker. Explain modular programming. Dividing the program in to sub programs (modules/function) to achieve the given task is modular approach. More generic functions definition gives the ability to re-use the functions, such as built-in library functions. What is a token? A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol. What is a preprocessor? Preprocessor is a directive to the compiler to perform certain things before the actual compilation process begins. Explain the use of %i format specifier w.r.t scanf(). Can be used to input integer in all the supported format. How can you print a (backslash) using any of the printf() family of functions. Escape it using (backslash). Does a break is required by default case in switch statement? Yes, if it is not appearing as the last case and if we do not want the control to flow to the following case after default if any. When to user -> (arrow) operator. If the structure/union variable is a pointer variable, to access structure/union elements the arrow operator is used. What are bit fields? We can create integer structure members of differing size apart from non-standard size using bit fields. Such structure size is automatically adjusted with the multiple of integer size of the machine. What are command line arguments? Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 4. The arguments which we pass to the main() function while executing the program are called as command line arguments. The parameters are always strings held in the second argument (below in args) of the function which is array of character pointers. First argument represents the count of arguments (below in count) and updated automatically by operating system. main( int count, char *args[]) { } What are the different ways of passing parameters to the functions? Which to use when?  Call by value − We send only values to the function as parameters. We choose this if we do not want the actual parameters to be modified with formal parameters but just used.  Call by reference − We send address of the actual parameters instead of values. We choose this if we do want the actual parameters to be modified with formal parameters. What is the purpose of built-in stricmp() function. It compares two strings by ignoring the case. Describe the file opening mode “w+”. Opens a file both for reading and writing. If a file is not existing it creates one, else if the file is existing it will be over written. Where the address of operator (&) cannot be used? It cannot be used on constants. It cannot be used on variable which are declared using register storage class. Is FILE a built-in data type? No, it is a structure defined in stdio.h. What is reminder for 5.0 % 2? Error, It is invalid that either of the operands for the modulus operator (%) is a real number. How many operators are there under the category of ternary operators? There is only one operator and is conditional operator (? : ). Which key word is used to perform unconditional branching? goto What is a pointer to a function? Give the general syntax for the same. A pointer holding the reference of the function is called pointer to a function. In general it is declared as follows. T (*fun_ptr) (T1,T2…); Where T is any date type. Once fun_ptr refers a function the same can be invoked using the pointer as follows. fun_ptr(); [Or] (*fun_ptr)(); Explain the use of comma operator (,). Comma operator can be used to separate two or more expressions. Eg: printf(“hi”) , printf(“Hello”); What is a NULL statement? Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 5. A null statement is no executable statements such as ; (semicolon). Eg: int count = 0; while( ++count<=10 ) ; Above does nothing 10 times. What is a static function? A function’s definition prefixed with static keyword is called as a static function. You would make a function static if it should be called only within the same source code. Which compiler switch to be used for compiling the programs using math library with gcc compiler? Opiton –lm to be used as > gcc –lm <file.c> Which operator is used to continue the definition of macro in the next line? Backward slash () is used. E.g. #define MESSAGE "Hi, Welcome to C" Which operator is used to receive the variable number of arguments for a function? Ellipses (…) is used for the same. A general function definition looks as follows void f(int k,…) { } What is the problem with the following coding snippet? char *s1 = "hello",*s2 = "welcome"; strcat(s1,s2); s1 points to a string constant and cannot be altered. Which built-in library function can be used to re-size the allocated dynamic memory? realloc(). Define an array. Array is collection of similar data items under a common name. What are enumerations? Enumerations are list of integer constants with name. Enumerators are defined with the keyword enum. Which built-in function can be used to move the file pointer internally? fseek() What is a variable? A variable is the name storage. Who designed C programming language? Dennis M Ritchie. C is successor of which programming language? B Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 6. What is the full form of ANSI? American National Standards Institute. Which operator can be used to determine the size of a data type or variable? sizeof Can we assign a float variable to a long integer variable? Yes, with loss of fractional part. Is 068 a valid octal number? No, it contains invalid octal digits. What it the return value of a relational operator if it returns any? Return a value 1 if the relation between the expressions is true, else 0. How does bitwise operator XOR works. If both the corresponding bits are same it gives 0 else 1. What is an infinite loop? A loop executing repeatedly as the loop-expression always evaluates to true such as while(0 == 0) { } Can variables belonging to different scope have same name? If so show an example. Variables belonging to different scope can have same name as in the following code snippet. int var; void f() { int var; } main() { int var; } What is the default value of local and global variables? Local variables get garbage value and global variables get a value 0 by default. Can a pointer access the array? Pointer by holding array’s base address can access the array. What are valid operations on pointers? The only two permitted operations on pointers are  Comparision ii) Addition/Substraction (excluding void pointers) What is a string length? It is the count of character excluding the ‘0’ character. What is the built-in function to append one string to another? strcat() form the header string.h Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 7. Which operator can be used to access union elements if union variable is a pointer variable? Arrow (->) operator. Explain about ‘stdin’. stdin in a pointer variable which is by default opened for standard input device. Name a function which can be used to close the file stream. fclose(). What is the purpose of #undef preprocessor? It be used to undefine an existing macro definition. Define a structure. A structure can be defined of collection of heterogeneous data items. Name the predefined macro which be used to determine whether your compiler is ANSI standard or not? __STDC__ What is typecasting? Typecasting is a way to convert a variable/constant from one type to another type. What is recursion? Function calling itself is called as recursion. Which function can be used to release the dynamic allocated memory? free(). What is the first string in the argument vector w.r.t command line arguments? Program name. How can we determine whether a file is successfully opened or not using fopen() function? On failure fopen() returns NULL, otherwise opened successfully. What is the output file generated by the linker. Linker generates the executable file. What is the maximum length of an identifier? Ideally it is 32 characters and also implementation dependent. What is the default function call method? By default the functions are called by value. Functions must and should be declared. Comment on this. Function declaration is optional if the same is invoked after its definition. When the macros gets expanded? At the time of preprocessing. Can a function return multiple values to the caller using return reserved word? Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)
  • 8. No, only one value can be returned to the caller. What is a constant pointer? A pointer which is not allowed to be altered to hold another address after it is holding one. To make pointer generic for which date type it need to be declared? Void Can the structure variable be initialized as soon as it is declared? Yes, w.r.t the order of structure elements only. Is there a way to compare two structure variables? There is no such. We need to compare element by element of the structure variables. Which built-in library function can be used to match a patter from the string? Strstr() What is difference between far and near pointers? In first place they are non-standard keywords. A near pointer can access only 2^15 memory space and far pointer can access 2^32 memory space. Both the keywords are implementation specific and are non-standard. Can we nest comments in a C code? No, we cannot. Which control loop is recommended if you have to execute set of statements for fixed number of times? for – Loop. What is a constant? A value which cannot be modified is called so. Such variables are qualified with the keyword const. Can we use just the tag name of structures to declare the variables for the same? No, we need to use both the keyword ‘struct’ and the tag name. Can the main() function left empty? Yes, possibly the program doing nothing. Can one function call another? Yes, any user defined function can call any function. Apart from Dennis Ritchie who the other person who contributed in design of C language. Brain Kernighan Prepared by Prof. Gunjan Mukherjee(MCA Dept,RERF)