- 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
Pointers in C Interview Questions & Answers - Learning Mode

Pointers in C Interview Questions & Answers - Learning Mode

A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type. The unary or monadic operator & gives the ``address of a variable''. The indirection or dereference operator * gives the ``contents of an object pointed to by a pointer''. A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable address.

Try Pointers in C Interview Questions & Answers - Exam Mode

1 2 3 Next

Sort By : Latest First | Oldest First | By Rating

Pointers in C Interview Questions & Answers - Learning Mode
Try Pointers in C Interview Questions & Answers - Exam Mode
Question: What is the difference between far and near?

Answer: Some compilers for PC compatibles use two types of pointers.
near pointers are 16 bits long and can address a 64KB range. far pointers are 32 bits long and can address a 1MB range.

Near pointers operate within a 64KB segment. There?s one segment for function addresses and one segment for data. far pointers have a 16-bit base (the segment address) and a 16-bit offset. The base is multiplied by 16, so a far pointer is effectively 20 bits long. Before you compile your code, you must tell Source:
Question: Difference between arrays and pointers?

Answer: Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them<br><br>Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression. Source:
Question: What is :- pointer , NULL pointer , dangling pointer , far pointer , near pointer , huge pointer , generic pointer , smart pointer ?

Answer: A null pointer has a reserved value, often but not necessarily the value zero, indicating that it refers to no object.
In most C programming environments malloc returns a null pointer if it is unable to allocate the memory region requested, which notifies the caller that there is insufficient memory available.

Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. Dangling pointers arise when an object is de Source:
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 Source:
Question: Why should we assign NULL to the elements (pointer) after freeing them?

Answer: This is paranoia based on long experience. After a pointer has been freed, you can no longer use the pointed-to data. The pointer is said to ?dangle?; it doesn?t point at anything useful. If you ?NULL out? or ?zero out? a pointer immediately after freeing it, your program can no longer get in trouble by using that pointer. True, you might go indirect on the null pointer instead, but that?s something your debugger might be able to help you with immediately. Also, there still might be copies of th Source:
Question: When should a far pointer be used?

Answer: Sometimes you can get away with using a small memory model in most of a given program. There might be just a few things that don?t fit in your small data and code segments. When that happens, you can use explicit far pointers and function declarations to get at the rest of memory. A far function can be outside the 64KB segment most functions are shoehorned into for a small-code model. (Often, libraries are declared explicitly far, so they?ll work no matter what code model the program uses.)
A Source:
Question: What is a null pointer?

Answer: There are times when it?s necessary to have a pointer that doesn?t point to anything. The macro NULL, defined in <stddef.h>, has a value that?s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.

The null pointer is used in three ways:

1) To stop indirection in a recursive data structure

2) As an error value

3) As a sentinel value Source:
Question: Is **p and &(*p) same?

Answer: No both are not equal.**p s pointer to another pointer where as &(*P) is equal to p.. Source:
Question: What is indirection?

Answer: If you declare a variable, its name is a direct reference to its value. If you have a pointer to a variable, or any other object in memory, you have an indirect reference to its value. Source:
Question: Between a long pointer and a char pointer , which one consumes more memory? explain

Answer: Both will consume same amount of memory.why because they means long or char pointer always stores the address of the character or long integer .

Question: How I can add two numbers in c language without using Arithmetic operators?

Answer: by using bitwise operators it is possible, for example a=8,ie in binary(00001000) & b=4 in binary (00000100)if we add a,b then we get 12 in binary(00001100)..if u add the binary a,b & convert the answer in to decimal we get 12.. in the c code is:
void main()
int a=8,b=4,c;
so,by using ^ operator we can do th Source:
Question: What do you mean by normalisation of pointers

Answer: Normalization functions are provided which take any of these combined types as their first argument, a pointer to the same combined type as their second argument, and place the normalization of the first into the second. Source:
Question: What are the uses of pointers in c and c++ language?

Answer: pointer ,points the value at the gives the value stored at a particular address. Source:
Question: In the following code, what is p2?

typedef int* ptr

ptr p1, p2;

Answer: An integer pointer. C provides a facility for creating new data type names. Source:
Question: What is pointer?

Answer: pointer is a collections of variables. Source:
Question: What is file pointer and its working method?

Answer: when a pointer is pointing to the address of a file than it is called as a file pointer.
for example:
FILE *fp;
here in above statement we are declaring a file pointer.
there are many modes of opening a file.they are read ,write,append ..
they are as follows..
above statement is opening a file in read mode..

Question: What is a pointer value and address?

Answer: A pointer value is a data object that refers to a memory location. Each memory location is numbered in the memory. The number attached to a memory location is called the address of the location. Source:
Question: What does it mean when a pointer is used in an if statement?

Answer: Any time a pointer is used as a condition, it means ?Is this a non-null pointer?? A pointer can be used in an if, while, for, or do/while statement, or in a conditional expression. Source:
Question: Following declarations are same
const char *s;
char const *s;

Answer: False .
The reason is
first case : s is a pointer to a character which is constant. i.e the value at the address location which is being pointed by s cannot be changed.

second case: s is a constant pointer : i.e the address at which it is being pointed to cannot be changed but the char variable is changeable.

Question: When would you use a pointer to a function?

Answer: Pointers to functions are interesting when you pass them to other functions. A function that takes function pointers says, in effect, ?Part of what I do can be customized. Give me a pointer to a function, and I?ll call it when that part of the job needs to be done. That function can do its part for me.? This is known as a ?callback.? It?s used a lot in graphical user interface libraries, in which the style of a display is built into the library but the contents of the display are part of the ap Source:

1 2 3 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