C Interview Questions And Answers

C Interview Questions list for experienced

  1. Why can templates only be implemented in the header file?
  2. What is an undefined reference/unresolved external symbol error and how do I fix it?
  3. What is The Rule of Three?
  4. What is an Undefined behavior and sequence points
  5. Why is iostream::eof inside a loop condition considered wrong?
  6. Where and why do I have to put the "template" and "typename" keywords?
  7. What are the rules about using an underscore in a C++ identifier?
  8. what is Split a string in C++?
  9. Why is "using namespace std;" considered bad practice?
  10. How do I use arrays in C++?
  11. What is the copy-and-swap idiom?
  12. What is this weird colon-member (" : ") syntax in the constructor?
  13. What should main() return in C and C++?
  14. Why isn\'t sizeof for a struct equal to the sum of sizeof of each member?
  15. Where do I find the current C or C++ standard documents?
  16. What is the difference between a definition and a declaration?
  17. Do the parentheses after the type name make a difference with new?
  18. When can I use a forward declaration?
  19. Is it possible to write a C++ template to check for a function\'s existence?
  20. What are move semantics?
  21. How do I tokenize a string in C++?
  22. interview questions on c++
  23. BASICS OF C++
  24. When to use while(0) and while(1)?
  25. When to use exit(0) and exit(1)?
  26. Which Keyword Can Be Used For Overloading?
  27. Can we use method for calling constructor?
  28. Is there any difference between overloading and overriding? If yes state it.
  29. Brief on this pointer.
  30. How to run a c++code on compiler?
  31. What are variables and constants?
  32. Classify all types of data types.
  33. Explain the structure of a code in c++.
  34. Write a program asking Rohit his saving amount and if the saving is greater than 5000 he will create a fixed deposit and if less than 5000 he will create a recurring deposit. Use if/else condition.
  35. what is the main purpose of loops? How many types of loops are there?
  36. WAP of printing numbers from 1-100 by just skipping the divisible of 3. (Use Jump and loop statement)
  37. What are Operators? Explain unary operators with examples.
  38. Brief on Bitwise operator
  39. What will be the difference in writing code for a rectangle and a hollow rectangle(pattern)?
  40. What are comments in c++?
  41. when the name of local & global variables are the same how will u access both of them one by one?
  42. What is the difference between equal to (==) and assignment operator(=)?
  43. What do you mean by void return type?
  44. Is there any difference between C and C++? If yes. State some of the important differences.
  45. What is the OOPS concept? name its 4 pillars.
  46. Printf() function is defined under which library in C?

C interview questions and answers on advance and basic C with example so this page for both freshers and experienced condidate. Fill the form below we will send the all interview questions on C also add your Questions if any you have to ask and for apply in C Tutorials and Training course just send a mail on info@pcds.co.in in detail about your self.

Top C interview questions and answers for freshers and experienced

What is C ?

Answer : C++ is a general-purpose programming language based on C. Use this tag for questions about code compiled with a C++ compiler

Questions : 1 :: Why can templates only be implemented in the header file?

template<typename T>struct Foo{    T bar;    void doSomething(T param) {/* do stuff using T */}};// somewhere in a .cppFoo<int>...View answers

Questions : 2 :: What is an undefined reference/unresolved external symbol error and how do I fix it?

The precedence among the syntax rules of translation is specified by the following phases Physical source file characters are mapped, in an implementation-defined manner, to the basic source...View answers

Questions : 3 :: What is The Rule of Three?


C++ treats variables of user-defined types with value semantics. This means that objects are implicitly copied in various contexts, and we should understand what "copying an object" actually...View answers

Questions : 4 :: What is an Undefined behavior and sequence points

At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken...View answers

Questions : 5 :: Why is iostream::eof inside a loop condition considered wrong?

Because iostream::eof will only be set after reading the end of the stream. It does not indicate, that the next read will be the end of the stream. Consider this (and assume then next read will be at...View answers

Questions : 6 :: Where and why do I have to put the "template" and "typename" keywords?


In order to parse a C++ program, the compiler needs to know for certain names whether they are types or not. The following example demonstrates that t * f; How should this be parsed? For many...View answers

Questions : 7 :: What are the rules about using an underscore in a C++ identifier?

The rules (which did not change in C++11): Reserved in any scope, including for use as implementation macros: identifiers beginning with an underscore and an uppercase letter identifiers...View answers

Questions : 8 :: what is Split a string in C++?

#include <iostream>#include <string>#include <sstream>#include <algorithm>#include <iterator>int main() {    using namespace std;    string...View answers

Questions : 9 :: Why is "using namespace std;" considered bad practice?


This is not related to performance at all. But consider this: You are using two libraries called Foo and Bar: usingnamespace foo;usingnamespace bar; Everything works fine, you can call Blah()...View answers

Questions : 10 :: How do I use arrays in C++?

Arrays on the type level An array type is denoted as T[n] where T is the element type and n is a positive size, the number of elements in the array. The array type is a product type of the element...View answers

Questions : 11 :: What is the copy-and-swap idiom?

Any class that manages a resource (a wrapper, like a smart pointer) needs to implement The Big Three. While the goals and implementation of the copy-constructor and destructor are straightforward,...View answers

Questions : 12 :: What is this weird colon-member (" : ") syntax in the constructor?

It's a member initialization list. You should find information about it in any good C++ book. You should, in most cases, initialize all member objects in the member initialization list (however,...View answers

Questions : 13 :: What should main() return in C and C++?

The return value for main should indicate how the program exited. Normal exit is generally represented by a 0 return value from main. Abnormal termination is usually signalled by a non-zero return...View answers

Questions : 14 :: Why isn't sizeof for a struct equal to the sum of sizeof of each member?

This is because of padding added to satisfy alignment constraints. Data structure alignment impacts both performance and correctness of programs: Mis-aligned access might be a hard error (often...View answers

Questions : 15 :: Where do I find the current C or C++ standard documents?

As of 1st September 2014, the best locations by price for C and C++ standards documents in PDF are: C++11 – ISO/IEC 14882:2011: $30 $60 from ansi.org C++03 – ISO 14882:2003: $30...View answers

Questions : 16 :: What is the difference between a definition and a declaration?

A declaration introduces an identifier and describes its type, be it a type, object, or function. A declaration is what the compiler needs to accept references to that identifier. These are...View answers

Questions : 17 :: Do the parentheses after the type name make a difference with new?

Let's get pedantic, because there are differences that can actually affect your code's behavior. Much of the following is taken from comments made to an "Old New Thing" article. Sometimes the...View answers

Questions : 18 :: When can I use a forward declaration?

Put yourself in the compiler's position: when you forward declare a type, all the compiler knows is that this type exists; it knows nothing about its size, members, or methods. This is why it's...View answers

Questions : 19 :: Is it possible to write a C++ template to check for a function's existence?

#include <iostream>struct Hello{    int helloworld()    { return 0; }};struct Generic {};// SFINAE testtemplate <typename T>class...View answers

Questions : 20 :: What are move semantics?

#include <cstring>#include <algorithm>class string{    char* data;public:    string(const char* p)   ...View answers

Questions : 21 :: How do I tokenize a string in C++?

Your simple case can easily be built using the std::string::find method. However, take a look at Boost.Tokenizer. It's great. Boost generally has some very cool string...View answers

Questions : 22 :: interview questions on c++

What is the full form of OOPS? Object Oriented Programming System. What is a class? Class is a blue print which reflects the entities attributes and actions. Technically defining a class is...View answers

Questions : 23 :: BASICS OF C++

1) what are the data types in c++? Ans): there are 4 data type              A) integer ( int)             B) character (...View answers

Questions : 24 :: When to use while(0) and while(1)?

The while keyword is used to apply condition for execution of the loop. It is control flow statement, in which a condition is specified, which may be either true or false at a time, and allows the...View answers

Questions : 25 :: When to use exit(0) and exit(1)?

Exit is a jump statement that is used in the C and C++ programming languages. It takes an integer to depict different exit status of the program. It tells whether the program was successfully...View answers

Questions : 26 :: Which Keyword Can Be Used For Overloading?

  Operator keyword. Example-     classCPoint3D{public:double x, y, z;CPoint3D(double dX =0.0,double dY =0.0,double dZ =0.0): x(dX), y(dY),...View answers

Questions : 27 :: Can we use method for calling constructor?

No, we can only use ‘this’ or ‘super’ to call constructor.The constructor is called just a single time, so you can securely do what you need, anyway the impediment of calling...View answers

Questions : 28 :: Is there any difference between overloading and overriding? If yes state it.

Yes, they are different.  Overloading: It is static in nature. It has same name as the function, but with different arguments. Overriding: It is dynamic in nature. It has the same...View answers

Questions : 29 :: Brief on this pointer.

It basically points to the current object of the class. The 'this' pointer is passed as a concealed contention to all nonstatic part work calls and is accessible as a neighborhood variable...View answers

Questions : 30 :: How to run a c++code on compiler?

Go to Desktop Go to that specified folder Open terminal/cmd and mention that folder where your file is. write: g++ filename.cpp -o (name of the run function) hit enter write (name of the run...View answers

Questions : 31 :: What are variables and constants?

Variables are something whose value we can modify according to requirements. It is basically a memory location.   Constants have their fixed value that can't be...View answers

Questions : 32 :: Classify all types of data types.

Primitive                       Derived                   ...View answers

Questions : 33 :: Explain the structure of a code in c++.

#include<iostream> int main() { std::cout<<"Hellon"; return 0; }   An ideal structure of the code: #: Preprocessor directive (used to include files) <iostream>:...View answers

Questions : 34 :: Write a program asking Rohit his saving amount and if the saving is greater than 5000 he will create a fixed deposit and if less than 5000 he will create a recurring deposit. Use if/else condition.

#include<iostream> using namespace std; int main() { int savings; cout<<"Enter your saving amountn"; cin>>savings; if(savings>5000){ cout<<"Create Fixed...View answers

Questions : 35 :: what is the main purpose of loops? How many types of loops are there?

Loops are simply used to reduce the number of lines in the code, making it less complex.  Suppose we want to write Hello 20 times. We can just add a loop in such cases and reduce the no of...View answers

Questions : 36 :: WAP of printing numbers from 1-100 by just skipping the divisible of 3. (Use Jump and loop statement)

int main() { for(int i=0;i<100;i++) { if(i%3==0){ continue; } cout<<i<<endl; }   Here endl means the end of the...View answers

Questions : 37 :: What are Operators? Explain unary operators with examples.

Operators: Symbols that tell the compiler to perform specific tasks/operations.  Arithmetic Operators: Binary Unary: ++(Incrementer), --(Decrementer) ++a: Pre incrementer(increment a...View answers

Questions : 38 :: Brief on Bitwise operator

Bitwise operator operates on bits and performs bit by bit operations. Let's look at each one by one: 1. & AND : 0101 0110 ______ 0100   2. | OR 0101 0110 ______ 0111   3....View answers

Questions : 39 :: What will be the difference in writing code for a rectangle and a hollow rectangle(pattern)?

There will be differences in the if the condition of both the codes. so let us focus on that part of the code because the rest will be the same.   Rectangle: No if condition is...View answers

Questions : 40 :: What are comments in c++?

Comments are the lines of code in c++ which are written by the programmer to just give the description of the code, they are directly ignored by the compiler. types: 1. //---- 2. /* ----*/ //...View answers

Questions : 41 :: when the name of local & global variables are the same how will u access both of them one by one?

When the name of both the variables are the same then we will call the variable (for example take it as "x"), then by default, the system will consider the local variable by this call. But if you...View answers

Questions : 42 :: What is the difference between equal to (==) and assignment operator(=)?

Equal to == operator is a relational operator which compares the left side and right side values and if they are equal it returns true else false.   Assignment operator(=) basically assigns...View answers

Questions : 43 :: What do you mean by void return type?

Generally all functions return some value. But in case you want your function to not return any value we use a keyword void in the function return type. As void suggests empty or having no value. So...View answers

Questions : 44 :: Is there any difference between C and C++? If yes. State some of the important differences.

C is a procedural language which means it focuses on the procedure more than the objects. So there is no role of objects, classes, and the four pillars of OOPS.  Whereas, C++ is an...View answers

Questions : 45 :: What is the OOPS concept? name its 4 pillars.

OOPS: Object-Oriented programming where the code is constructed keeping in mind everything is an object and building the code in this way. It basically makes understanding and code building an easy...View answers

Questions : 46 :: Printf() function is defined under which library in C?

 stdio.h    
More Question

Ask your interview questions on C

Write Your comment or Questions if you want the answers on C from C Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---