C Interview Questions And Answers

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
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* :
 

  






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