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 Interview Questions & Answers - Learning Mode
COOLINTERVIEW.COM PROGRAMMING LANGUAGES INTERVIEW QUESTIONS C INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE

C Interview Questions & Answers - Learning Mode

C is a high-level and general purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System (OS) in the early 1970s. With the increasing popularity of object-oriented programming, C is being rapidly replaced as "the" programming language by C++, a superset of the C language that uses an entirely different set of programming concepts, and by Java, a language similar to but simpler than C++, that was designed for use in distributed networks.

Try C Interview Questions & Answers - Exam Mode
Subcategories for C Interview Questions & Answers - Learning Mode

Following are sub categories for which Interview Questions & Answers are available under C Interview Questions & Answers - Learning Mode. Please select the appropriate sub-category:-

Arrays in C Interview Questions & Answers (18) Learning Mode | Exam Mode

Branches & Loops in C Interview Questions & Answers (22) Learning Mode | Exam Mode

C Basics Interview Questions & Answers (92) Learning Mode | Exam Mode

Dynamic Memory Allocation in C Interview Questions & Answers (21) Learning Mode | Exam Mode

File Operations in C Interview Questions & Answers (16) Learning Mode | Exam Mode

Functions in C Interview Questions & Answers (59) Learning Mode | Exam Mode

Operators in C Interview Questions & Answers (22) Learning Mode | Exam Mode

Pointers in C Interview Questions & Answers (43) Learning Mode | Exam Mode

Strings in C Interview Questions & Answers (32) Learning Mode | Exam Mode

Structures in C Interview Questions & Answers (39) Learning Mode | Exam Mode

Variables in C Interview Questions & Answers (39) Learning Mode | Exam Mode

Previous 1 2 3 4 5 6 7 8 Next

Sort By : Latest First | Oldest First | By Rating

C Interview Questions & Answers - Learning Mode
Try C Interview Questions & Answers - Exam Mode
Question: What is the difference between text and binary modes?




Answer: In binary mode, data takes less memory. To represent 123 in text mode, it takes three bytes. In binary mode it takes only one byte. Source: CoolInterview.com
Question: const int perplexed = 2;
#define perplexed 3
main()
{
#ifdef perplexed
#undef perplexed
#define perplexed 4
#endif
printf("%d",perplexed);
}




Answer: Ans will be two not 4 as that value perplexed is const variable and a const can not be changed
Source: CoolInterview.com
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: CoolInterview.com
Question: What is the difference between object and reference?

Answer: No answer available currently.
Question: main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%dn", bit >> (i - (i -1)));
}
}




Answer: Ans:256,256,256,256,256 depending upon i value it prints 5times Source: CoolInterview.com
Question: main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}




Answer: Ans is 256,512 because unsigned is data type.blockwise it will print Source: CoolInterview.com
Question: How can do search for data in a linked list ?

Answer: Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list?s members can be accessed is sequentially.

Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient. Source: CoolInterview.com
Question: What does it mean-

a[i]=i+i



Answer: a[i]=i+i;

its just simple... an assignment statement.

an i'th element of array a (i.e.,) a[i] is going to have a value i+i;

eg; lets i=3 means

a[3]=3+3;

a[3]=6;
Source: CoolInterview.com
Question: main()
{
signed int bit=512, mBit;
{
mBit = ~bit;
bit = bit & ~bit ;
printf("%d %d", bit, mBit);
}
}





Answer: Two's complement:

00000000000000001111111111111111 "Not operation" ->

11111111111111110000000000000000 assign to int, since highest position is 1, then Not operation again, ->

10000000000000001111111111111111, then plus 1->

10000000000000010000000000000000, it is - 513
Source: CoolInterview.com
Question: main()
{
int c = 5;
printf("%d", main||c);
}




Answer: Ans will be 1

Source: CoolInterview.com
Question: main()
{
int i, j;
scanf("%d %d"+scanf("%d %d", &i, &j));
printf("%d %d", i, j);
}




Answer: In the statement scanf("%d %d"+scanf("%d %d", &i, &j)); the first two values are read into i and j. for the third value it is a null pointer assignment. so segmentation fault occurs at run time. Source: CoolInterview.com
Question: main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcpy(a,b));
}




Answer: "World".when we use strcpy..contents of a are overwritten. Source: CoolInterview.com
Question: How to print the names of employees or students in alphabetical order using C programming?

Answer: #include<stdio.h>
#include<conio.h>
main()
{
char names[40][20],temp[20];
int i,n,j;
clrscr();
printf("
How many names?:");
scanf("%d",&n);
printf("
Enter the %d names one by one
",n);
for(i=0;i<n;i++)
scanf("%s",names[i]);
for(i=0;i<=n-1;i++)
for(j=j+1;j<n;j++)
if(strcmp(names[i],names[j])>0)
{
strcpy(temp,names[i]);
strcpy(names[i],names[j]);
strcpy(names[j],temp);
}
printf("
Names in Alphabetica Source: CoolInterview.com
Question: What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

Answer: These are all serious errors, symptoms of a wild pointer or subscript.
Null pointer assignment is a message you might get when an MS-DOS program finishes executing. Some such programs can arrange for a small amount of memory to be available ?where the NULL pointer points to (so to speak).

If the program tries to write to that area, it will overwrite the data put there by the compiler.

When the program is done, code generated by the compiler examines that area. If that data has b Source: CoolInterview.com
Question: void main ()
{
int x = 10;
printf ("x = %d, y = %d", x,--x++);
}




Answer: Ans: Lvalue required..

it will print first value .but in second value it will perform preincrement operater which will result as a int value but we can't postincrement that value,we can postincrement variable.so it requires a variable to store that value so it gives Lvalue required error.
Source: CoolInterview.com
Question: How to write a program to print its own source code?

Answer:
char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";main(){printf(s,34,s,34);}

Explanation

As per the ascii table for 34 the char is Double Quotes (") shown below
Char Dec Oct Hex

" 34 0042 0x22


simple understanding : line by line

char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";
main()
{
printf(s,34,s,34);
}

for simple printf execution out put the below line gets printed which is a string

char Source: CoolInterview.com
Question: What is page thrashing ?

Answer: Some operating systems (such as UNIX or Windows in enhanced mode) use virtual memory. Virtual memory is a technique for making a machine behave as if it had more memory than it really has, by using disk space to simulate RAM (random-access memory).

In the 80386 and higher Intel CPU chips, and in most other modern microprocessors (such as the Motorola 68030, Sparc, and Power PC), exists a piece of hardware called the Memory Management Unit, or MMU.

The MMU treats memory as if it wer Source: CoolInterview.com
Question: How to write functions in c program without using headerfile.

Answer: No answer available currently.
Question: main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}




Answer: Compile error. Illegal syntax Source: CoolInterview.com
Question: Difference between const char* p and char const* p

Answer: In const char* p, the character pointed by ?p? is constant, so u cant change the value of character pointed by p but u can make ?p? refer to some other location.

in char const* p, the ptr ?p? is constant not the character referenced by it, so u cant make ?p? to reference to any other location but u can change the value of the char pointed by ?p?. Source: CoolInterview.com

Previous 1 2 3 4 5 6 7 8 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.125 Seconds