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: main()
{
int i = 100;
clrscr();
printf("%d", sizeof(sizeof(i)));
}




Answer: Internal sizeof(i) gives output 2.2 is integer so outer sizeof()again gives output 2.

Source: CoolInterview.com
Question: What is data independence? what is transaction process application? Discuss the main charecteristics of data approach how it differs from traditional file system!

Answer: No answer available currently.
Question: How can you get the number of elements in an array allocated dynamically at runtime?
For example -
int *p = (int *) malloc(sizeof(int) * n);

int numElems = ??????? /* n is not available here */




Answer: To get the numElements in a situation where we don't know the n following logic will work.

1. First get the total size of array. i.e. X = sizeof(p) * n

2. Now divide the X with size of each element. numElements = X/sizeof(int).
Source: CoolInterview.com
Question: What are enumerations?

Answer: enumerations is one type of user defined data type Source: CoolInterview.com
Question: If the following program (myprog) is run from the command line as myprog friday tuesday sunday, What would be the output?

main(int argc, char*argv[])
{
printf("%c",**++argv);
}






Answer: Answer is B) f;

Source: CoolInterview.com
Question: main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("n %d", i);
}




Answer: using cc complier on linux fedore, it prints garbage value!! Source: CoolInterview.com
Question: main()
{
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("%dn", 1L << i);
}
}




Answer: Ans is A. because l means it always assign to 1. Source: CoolInterview.com
Question: What would be the output of the following program?
main()
{
int i=4;
switch(i)
{
default:
printf("n A mouse is an elephant built by the Japanese");
case 1:
printf(" Breeding rabbits is a hair raising experience");
break;
case 2:
printf("n Friction is a drag");
break;
case 3:
printf("n If practice make perfect, then nobody's perfect");
}
}





Answer: Ans : c because in switch i value no match.first default will b printed.no break after default that's why case1 will b printed. Source: CoolInterview.com
Question: How to find GCD of four numbers?

Answer: Take 4 numbers.The smallest number has to be found out.Then divide each number by that numbers which are less than that smallest number.
e.g.5,15,75,20
smallest-5
so divide each numbers by 1,2,3,4,5.
The GCD will be that number which divides all the number.(here 5) Source: CoolInterview.com
Question: main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}




Answer: o/p is (D).It prints nothing.

Though we r initializing x to 5 but in for loop it does not satisfies the condoition (x< 0),it fails.without entering in the for loop it exit from th emain program.

Source: CoolInterview.com
Question: How to convert decimal to octal and hexadecimal?

Answer: /*To Convert a Decimal number to Octal and Hexadecimal*/
#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,n,z,x,b,c,d[100];
clrscr();
printf("Enter a Number : ");
scanf("%d",&n);
z=n;
b=1;
while(n>0)
{c=n%8;
b=b*10+c;
n=n/8;}
n=b;
b=0;
while(n>0)
{c=n%10;
b=b*10+c;
n=n/10;}
b=b/10;
printf("Octal Value for the given number is : %d ",b);
n=z;
b=0;
i=0;
while(n>0)
{c=n%16;
d[i]=c;
n= Source: CoolInterview.com
Question: main()
{
int i =10, j = 20;
clrscr();
printf("%d, %d, ", j-- , --i);
printf("%d, %d ", j++ , ++i);
}




Answer: A) 20, 9, 19, 10
in first -- printf "j" will be printed first then subtracted one from it. however from "i" one will subtracted before printing it on the screen


Source: CoolInterview.com
Question: main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf("%f", i/(*p) ); // i is divided by pointer p
}




Answer: It will mostly give run time error and not compile time error....

Also use typecasting i.e. use (float)i/(*p); and you will get 1.0000.. as the answer
Source: CoolInterview.com
Question: How to write a 'C' program to read an array of 10 numbers and print the prime nums?

this is what i wrote
could someone tell me where is my mistake?
can i use here flag at all?

#include <stdio.h>

void main ()
{
int arr[10], i, j, flag;

for (i=0;i<10;i++)

scanf ("%d", &arr[i]);

for (i=0;i<10;i++)
{
flag=1;


for (j=2;j<=(arr[i]/2); j++)
{
if (arr[i]%j==0)
{
flag=0;
break;

}
}
}

for (i=0;i<10;i++)
{
if (flag=1)

printf ("%d", arr[i]);
}


Answer: Hi, U r using the same flag for all the 10 numbers and after coming out of the two loops u r printing the numbers based on the value of the flag but the flag will contain the value thats been updated by the last number in the array..thats absolutely wrong..here is the correct program...

#include <stdio.h>

void main ()
{
int arr[10], i, j, flag;

for (i=0;i<10;i++)

scanf ("%d", &arr[i]);

for (i=0;i<10;i++)
{
flag=1;


for (j=2;j&l Source: CoolInterview.com
Question: What would be the output of the following program?

main()
{
int y=128;
const int x=y;
printf("%d",x);
}





Answer: Correct ans is A) 128 Source: CoolInterview.com
Question: How to do a simple program simulation of a Rotation game?
A player chooses to move a box encompassing four numbers, and then chooses to either rotate the numbers
clockwise or counterclockwise.


Answer: No answer available currently.
Question: What is the difference between the following statements?
int a[4]={1,2,3,4};
int a[]={1,2,3,4);


Answer: In the second array
The braces which closes the elements are wrong,
it should be flower braces. Source: CoolInterview.com
Question: What is :- Token , identifier , block , parameter , argument , scope of variable , Macro ?

Answer: No answer available currently.
Question: What is type integration? And what is integer type integration?

Answer: No answer available currently.
Question: How should i rate on the basis of the basis of the scenario the insertion sort , bubble sort , Quick Sort?

Answer: quick sort is better than both insertion & bubble.
insertion sort is better than bubble sort.
comparison is on the basis of their execution times(both best & worst execution times) 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