100 C Interview Questions and Answers - C Online Test
100 C Interview Questions and Answers - C Online Test
1 of 8
http://careerride.com/C-Interview-Questions.aspx
Interview Q&A Videos Placement papers HR interview CV Cover letter GD Aptitude Current Affairs Exam English Career Q & A Online test Jobs
C interview part 2
C interview part 3
C interview part 4
C interview part 6
C interview part 7
C interview part 5
C interview part 8
C interview part 9
-by using dynamic linking for libraries.
-by using static linking for libraries.
-Both are correct
-None of above are correct
C interview part 10
C interview part 11
C interview part 12
C interview part 13
C interview part 14
C interview part 15
C Bit operations
C function and pointers
C functions
C pointers
C preprocessor
C Structures and Union
QUESTION - Recursive data structures are almost always implemented with memory from the __________
-stack
-heap
-processor
-RAM
View Answer / Hide Answer
QUESTION - static variables are local in scope to the block or file in which they are defined, but their
lifespan is throughout the program.
-True
-False
View Answer / Hide Answer
18/12/2014 7:18 PM
2 of 8
http://careerride.com/C-Interview-Questions.aspx
-The value of a static variable in a function is retained between repeated function calls to the same function.
-static variables are allocated on the heap
-static variables do not retain its old value between function calls
-The scope of static variable is local to the block in which it is defined.
View Answer / Hide Answer
QUESTION - One that can be modified by the class even when the object of the class or the member
function doing the modification is const it is known as______________
-member function
-mutable member
-constant member
-none of these
View Answer / Hide Answer
QUESTION - A __________is a single-parameter constructor that is declared without the function specifier
explicit.
-converting constructor
-copy constant
-dangling pointer
-none of these
View Answer / Hide Answer
QUESTION - What function should be used to release allocated memory which is no longer needed?
-free()
-dealloc()
-release()
-dropmem()
-unalloc()
View Answer / Hide Answer
QUESTION - What function should be used to free the memory allocated by calloc() ?
-dealloc();
-malloc(variable_name, 0)
-free();
-memalloc(variable_name, 0)
View Answer / Hide Answer
QUESTION - In C, if you pass an array as an argument to a function, what actually gets passed?
-Value of elements in array
-First element of the array
-Base address of the array
-Address of the last element of array
View Answer / Hide Answer
QUESTION - The library function used to find the last occurrence of a character in a string is
-strnstr()
-laststr()
-strrchr()
-strstr()
View Answer / Hide Answer
18/12/2014 7:18 PM
3 of 8
http://careerride.com/C-Interview-Questions.aspx
-Defining
-Declaring
-Prototyping
-Calling
View Answer / Hide Answer
C interview questions - May 31, 2013 at 11:55 AM by Kshipra Singh
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM
4 of 8
http://careerride.com/C-Interview-Questions.aspx
- As such, there is no limit to the number of levels of nested include files you can have but your compiler might run out of stack space while
trying to include an inordinately high number of files. This number depends on your hardware configuration and compiler.
- Although it is legal to nest include files yet you must avoid it. An include level should be created only where it is required and makes sense,
like creating an include file that has an #include statement for each header required by the module you are working with.
How does placing some code lines between the comment symbol help in debugging the code?
- Placing comment symbols /* */ around a code isolates some code that the coder believes might be causing the errors in the program, without
deleting it. - If the code is correct, you can just remove the comment symbols, without needing to retype it.
- If it is wrong, you can just remove it.
Are comments included during the compilation stage and placed in the EXE file as well?
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM
5 of 8
http://careerride.com/C-Interview-Questions.aspx
Define recursion in C
A programming technique in which a function may call itself. Recursive programming is especially well-suited to parsing nested markup
structures.............
Read answer
Describe about storage allocation and scope of global, extern, static, local and register variables
The storage allocation / class determine the memory part where the storage space is allocated for variables, functions and how long the
allocation of storage continues to exist............
Read answer
Define register variables. What are the advantages of using register variables?
The variables of register type modifier will inform the compiler for storing the variables in a register of CPU.............
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM
6 of 8
http://careerride.com/C-Interview-Questions.aspx
Can we specify variable field width in a scanf() format string? If possible how?
It is possible to specify variable field width in a scanf() format string. By using %s control string...........
Read answer
Out of fgets() and gets() which function is safe to use and why?
The function fgets() function is safer to use. It checks the bounds.........
Read answer
Convert Any File to a PDF - Word, Jpeg, Gif 100% Free Download!
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM
7 of 8
http://careerride.com/C-Interview-Questions.aspx
cquestion
read
anurag 09-20-2014 05:49 AM
C Interview questions and answers
What are near and far pointers?
Near and Far pointers are system specific and the use of it, has been decreased over the years, it has now become obsolete. These are
supported by 16-bit programming languages. To know the machine that doesnt require these kinds of pointers, use a preprocessor or remove
the unnecessary near, far pointer keywords.
How can I change the size of the dynamically allocated array?
You can change the size of the array if it is defined dynamically, by using the realloc() function. realloc() functions syntax is written as:
dynarray = realloc(dynarray, 20 * sizeof(int));
But, realloc() function cant just enlarge the memory, and this memory allocation depends on the space available in the system. If realloc()
cant find the space available, then it returns null pointer.
How to write a multi-statement macro?
Macro are simple statements which are written to, dynamically execute the method or function. The function call syntax is:
MACRO(arg1, arg2);
Macro can be included with the conditional statements using the external else clause. You can include simple expressions in macro with no
declarations or loops like:
#define FUNC(arg1, arg2) (expr1, expr2, expr3)
What's the right way to use errno?
The errors should be checked by return values. Errno defines among various causes of an error, such as File not found or Permission
denied. Errno detects only when a function doesnt have a unique or unambiguous errors. Errno can be set manually to 0 to find the errors.
Error messages can be made useful if the program name with the error can be printed so that the error can be noticed and solved.
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM
8 of 8
http://careerride.com/C-Interview-Questions.aspx
public:
static t rectangular(float x); // Rectangular coord's
static Point polar(float radius); // Polar coordinates
// These static methods are the so-called "named constructors"
}
Placement practice test: Java | SAP | .NET | Oracle | Sql Server | QA | Aptitude | Networking | All Skills
18/12/2014 7:18 PM