CoolInterview.com - 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
COOLINTERVIEW.COM C INTERVIEW QUESTIONS C BASICS INTERVIEW QUESTIONS 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

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #in Source: CoolInterview.com
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: CoolInterview.com
Question: Write the equivalent expression for x%8?

Answer: x&7 Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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 <macros.inc>

in your program, the file macros.inc 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: CoolInterview.com
Question: Can we execute printf statement without using semicolan?

Answer: if(printf("print anything"))
{} Source: CoolInterview.com
Question: How can C programs run without header files?

Answer: c programming run without header file
write example given below.
void main()
{
clrscr();
printf("hello");
getch();
} Source: CoolInterview.com
Question: how to create love flames program using c language

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

printf("Enter Ur Partner's Name
");
scanf("%s",b);
strcpy(q,a);
strcpy(w,b);
n=strlen(a);
c=strlen(b);
for(i=0;i<n;i++)
{
m=a[i];
for(j=0;j<c;j++)
{
if(m==b[j])
{
a[i]=-1;
b[j]=-1;
s=s+2;
break;
}
}
Source: CoolInterview.com
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: CoolInterview.com
Question: Can you write a c program without using main function?

Answer: we can write the programme without main but it can't run becuase linking is from main(). Source: CoolInterview.com
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: CoolInterview.com
Question: Define structural language and procedural language?

Answer: COBOL is structure language

C is a procedure language. Source: CoolInterview.com
Question: Is it possible to print graphics output in C?

Answer: No. Source: CoolInterview.com
Question: How to perform addition,subtraction of 2 numbers without using addition and subtraction operators?

Answer: yes we can
1)using xor
2)a--b
3)a2-b2/a-b Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: How do you override a defined macro?

Answer: You can use the #undef preprocessor directive to undefine (override) a previously defined macro. Source: CoolInterview.com
Question: What is object file? How can you access object file?

Answer:
Question: How to find a given number is armstrong number or not in "c".?



Answer: given no ,n=153,

n1=n; while(n>=0) {

r=n%10;

sum+=r*r*r;

n=n/10;}

if(n1==sum)then armstrong else not


Source: CoolInterview.com

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