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

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 output of printf("%d") ?

Answer: 1. When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothing after %d so compiler will show in output window garbage value.

2. When we use %d the compiler internally uses it to access the argument in the stack (argument stack). Ideally compiler determines the offset of the data variable depending on the format specification string. Now when we write printf("%d",a) then compiler first accesses the top most element in the argument stack of th Source: CoolInterview.com
Question: vii)7. main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}




Answer: Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression ?i++ && j++ && k++? is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ?0 || 0? combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1.
Source: CoolInterview.com
Question: In the following code, in which order the functions would be called?
x = f1(23,14)*f2(12/4)+f3();

a) f1, f2, f3
b) f3, f2, f1
c) The order may vary from compiler to compiler
d) None of the above



Answer: The order may vary from compiler to compiler in C in which order function will be called depends on compiler Source: CoolInterview.com
Question: Can anyone share his code which would accept a sentence, then count the number occurrence of the words excluding spaces.All is done using linked list.

Answer: No answer available currently.
Question: I want source code of series of prime numbers.

Answer: #include<stdio.h>
main()
{ long i,n;
printf("Up To which range do u wnt prime no: ");
scanf("%ld",&n);
printf("The prime numbers with 1 to %ld range are...... ",n);
for(i=1;i<=n;i++)
{ for(j=1,k=0;j<i;j++)
{if(i%j==0)
k++;
if(k>1)
break;
}
if(k==1)
printf("%5ld",i);
}
} Source: CoolInterview.com
Question: How can you restore a redirected standard stream ?

Answer: The preceding example showed how you can redirect a standard stream from within your program. But what if later in your program you wanted to restore the standard stream to its original state?

By using the standard C library functions named dup() and fdopen(), you can restore a standard stream such as stdout to its original state.

The dup() function duplicates a file handle. You can use the dup() function to save the file handle corresponding to the stdout standard stream.

T Source: CoolInterview.com
Question: All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
?? Programs run under DOS environment,
?? The underlying machine is an x86 system,
?? Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).

Predict the output or error(s) for the following:

i) void main()
{
int const * p=5;
printf("%d",++(*p));
}




Answer: error: increment of read-only location Source: CoolInterview.com
Question: main()
{
int x=5;
for(;x!=0;x--) {
printf("x=%dn", x--);
}
}




Answer: The answer is an infinite loop. (5 3 1 .... )

here it never goes to 0 and so condition will always be true
Source: CoolInterview.com
Question: There is any methodology in which we can print a string in c without using semicolon(;)
suggest me if there is ?


Answer: void main ()
{
if (printf ("%s","STRING"))
;
} Source: CoolInterview.com
Question: How can we get direct printout of a c file without giving print command from bin or tc?eg i want to get the printout of a program directly after execution from the c window itself.

Answer: Using putchar(variable name) we can print single character Source: CoolInterview.com

Previous 1 2 3 4 5 6 7 8



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.0625 Seconds