- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
C Basics Interview Questions & Answers - Learning Mode

C Basics Interview Questions & Answers - Learning Mode

C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.

Try C Basics Interview Questions & Answers - Exam Mode

1 2 3 4 5 Next

Sort By : Latest First | Oldest First | By Rating

C Basics Interview Questions & Answers - Learning Mode
Try C Basics Interview Questions & Answers - Exam Mode
Question: What is the difference between #include <file> and #include ?file??

Answer: When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable


using the #in Source:
Question: how to create love flames program using c language

Answer: #include<stdio.h>
void main()
int i,j,n,c,s=0,p,t,y;
char a[25],b[25],m,q[25],w[25];
printf("Enter Ur Name

printf("Enter Ur Partner's Name
Question: Is it possible to execute code even after the program exits the main() function?

Answer: The standard C library provides a function named atexit() that can be used to perform ?cleanup? operations when your program terminates. You can set up a set of functions you want to perform automatically when your program exits by passing function pointers to the at exit() function. Source:
Question: Write the equivalent expression for x%8?

Answer: x&7 Source:
Question: Can you define which header file to include at compile time?

Answer: Yes. This can be done by using the #if, #else, and #endif preprocessor directives. For example, certain
compilers use different names for header files. One such case is between Borland C++, which uses the header file alloc.h, and Microsoft C++, which uses the header file malloc.h. Both of these headers serve the same purpose, and each contains roughly the same definitions. If, however, you are writing a program that is to support Borland C++ and Microsoft C++, you must define which header to Source:
Question: How can type-insensitive macros be created?

Answer: A type-insensitive macro is a macro that performs the same basic operation on different data types.

This task can be accomplished by using the concatenation operator to create a call to a type-sensitive function based on the parameter passed to the macro. The following program provides an example:

#include <stdio.h>
#define SORT(data_type) sort_ ## data_type
void sort_int(int** i);
void sort_long(long** l);
void sort_float(float** f);
void sort_string(char** s Source:
Question: How can you avoid including a header more than once?

Answer: One easy technique to avoid multiple inclusions of the same header is to use the #ifndef and #define
preprocessor directives. When you create a header for your program, you can #define a symbolic name that is unique to that header. You can use the conditional preprocessor directive named #ifndef to check whether that symbolic name has already been assigned. If it is assigned, you should not include the header, because it has already been preprocessed. If it is not defined, you should define i Source:
Question: Difference between :- 1) C and C++
2) main() in c and main() in c++ ?

Answer: C is a procedure oriented language.
C++ is a object oriented language. Source:
Question: Can a file other than a .h file be included with #include?

Answer: The preprocessor will include whatever file you specify in your #include statement. Therefore, if you have the line

#include <>

in your program, the file will be included in your precompiled program. It is, however, unusual programming practice to put any file that does not have a .h or .hpp extension in an #include statement.

You should always put a .h extension on any of your C files you are going to include. This method makes it easier for you Source:
Question: What is the difference between NULL and NUL?

Answer: NULL is a macro defined in <stddef.h> for the null pointer.

NUL is the name of the first character in the ASCII character set. It corresponds to a zero value. There?s no standard macro NUL in C, but some people like to define it.

The digit 0 corresponds to a value of 80, decimal. Don?t confuse the digit 0 with the value of ?? (NUL)!
NULL can be defined as ((void*)0), NUL as ??. Source:
Question: How do you override a defined macro?

Answer: You can use the #undef preprocessor directive to undefine (override) a previously defined macro. Source:
Question: What is a pragma?

Answer: The #pragma preprocessor directive allows each compiler to implement compiler-specific features that can be turned on and off with the #pragma statement. For instance, your compiler might support a feature called loop optimization. This feature can be invoked as a command-line option or as a #pragma directive.

To implement this option using the #pragma directive, you would put the following line into your code:

#pragma loop_opt(on)

Conversely, you can turn off loop optimiza Source:
Question: What is #line used for?

Answer: The #line preprocessor directive is used to reset the values of the _ _LINE_ _ and _ _FILE_ _ symbols,
respectively. This directive is commonly used in fourth-generation languages that generate C language source files. Source:
Question: How do you print an address?

Answer: The safest way is to use printf() (or fprintf() or sprintf()) with the %P specification. That prints a void
pointer (void*). Different compilers might print a pointer with different formats. Your compiler will pick
a format that?s right for your environment.

If you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a void*:

printf( ?%Pn?, (void*) buffer ); Source:
Question: How can C programs run without header files?

Answer: c programming run without header file
write example given below.
void main()
} Source:
Question: Can multiple catch blocks be executed?

Answer: No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block. Source:
Question: Is there anything you can do in C++ that you cannot do in C ?

Answer: U can even write big projects like design of compilers. Source:
Question: What are storage class in c?

Answer: There r of 4 type of storage class in C




Question: How can you check to see whether a symbol is defined?

Answer: You can use the #ifdef and #ifndef preprocessor directives to check whether a symbol has been defined
(#ifdef) or whether it has not been defined (#ifndef). Source:
Question: How to perform addition,subtraction of 2 numbers without using addition and subtraction operators?

Answer: yes we can
1)using xor
3)a2-b2/a-b Source:

1 2 3 4 5 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds