[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

# Pointers Questions

Home > Technical Aptitude > C Programming > Pointers > General Questions
NA
SHSTTON
50
Solv. Corr.
47
Solv. In. Corr.
97
Attempted
0 M:13 S
Avg. Time

1 / 60

We all know that a const variable needs to be initialized at the time of declaration. Then what will be the output of the program given below, even when we have not initialized p?

void main()
{
const char *p ;
p="A const pointer" ;
cout << p;
}

AA const pointer

Bnull

CCompiler Error: Pis not initialized

DNone of these

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
76
Solv. Corr.
113
Solv. In. Corr.
189
Attempted
0 M:0 S
Avg. Time

2 / 60

What is the output of the following C Program?
#include<stdio.h>
void main()
{
char *p;
int *q;
long *r;
p=q=r=0;
p++;
q++;
r++;
printf("%p...%p...%p",p,q,r);
}

AGarbage Value

B0001...0002...0004

CCompilation Error

DNone of these

Explanation:

++ operator when applied to pointers increments address according to their corresponding data-types.

Workspace

NA
SHSTTON
35
Solv. Corr.
84
Solv. In. Corr.
119
Attempted
0 M:0 S
Avg. Time

3 / 60

What is the output of the following C Program?
#include<stdio.h>
void main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}

A1 2

B1 1

C2 2

D2 1

ENone of these

Explanation:

The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.

Workspace

NA
SHSTTON
19
Solv. Corr.
147
Solv. In. Corr.
166
Attempted
0 M:0 S
Avg. Time

4 / 60

What is the output of the following C Program?
#include<stdio.h>
void main()
{
char far *farther,*farthest;

printf("%d   %d",sizeof(farther),sizeof(farthest));
}

A4 4

B2 4

C2 2

D4 2

ENone of these

Explanation:

the second pointer is of char type and not a far pointer

Workspace

NA
SHSTTON
77
Solv. Corr.
30
Solv. In. Corr.
107
Attempted
0 M:0 S
Avg. Time

5 / 60

What is the output of the following C Program?
#include<stdio.h>
void main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
}

AGarbage Value

B10

DNone of these

Explanation:

The variable i is a block level variable and the visibility is inside that block only. But the lifetime of i is lifetime of the function so it lives upto the exit of main function. Since the i is still allocated space, *j prints the value stored in i since j points i.

Workspace

NA
SHSTTON
62
Solv. Corr.
95
Solv. In. Corr.
157
Attempted
0 M:11 S
Avg. Time

6 / 60

What is the output of the following C Program?
#include<stdio.h>
int main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
return 0;
}

AHello

Bello

CH

DHe

ENone of these

Explanation:

* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again
& references it to an address and * dereferences it to the value H.

Workspace

NA
SHSTTON
41
Solv. Corr.
46
Solv. In. Corr.
87
Attempted
0 M:0 S
Avg. Time

7 / 60

What is the output of the following C Program?
#include<stdio.h>
int main()
{
char *cptr,c; void *vptr,v; c=10; v=0;
cptr=&c; vptr=&v;
printf("%c%v",c,v);
return 0;
}

ACompiler error : size of v is Unknown.

B%v

C10 %v

D10

ENone of these

Explanation:

You can create a variable of type void * but not of type void, since void is an empty type. In the second line you are creating variable vptr of type void * and v of type void hence an error.

Workspace

NA
SHSTTON
44
Solv. Corr.
43
Solv. In. Corr.
87
Attempted
0 M:0 S
Avg. Time

8 / 60

What is the output of the following C Program?
#include<stdio.h>
int one_d[]={1,2,3};
int main()
{
int *ptr;
ptr=one_d;
ptr+=3;
printf("%d",*ptr);
return 0;
}

A1

B2

C3

Dgarbage value

ENone of these

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
15
Solv. Corr.
70
Solv. In. Corr.
85
Attempted
3 M:38 S
Avg. Time

9 / 60

What is the output of the following C Program?
#include<stdio.h>
int main( ){
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf("%u %u %u %d \n",a,*a,**a,***a);
printf("%u %u %u %d \n",a+1,*a+1,**a+1,***a+1);
}

A1000, 1000, 1000, 21014, 1004, 1002, 3

B1002, 1002, 1002, 41014, 1004, 1008, 3

C1000, 1000, 1000, 41014, 1004, 1002, 3

D1000, 1000, 1000, 21014, 1004, 1002, 3

ENone of these

Explanation:

The given array is a 3-D one. It can also be viewed as a 1-D array.
2 4 7 8 3 4 2 2 2 3 3 4
1000 1002 1004 1006 1008 1010 1012 1014 1016 1018 1020 1022
thus, for the first printf statement a, *a, **a give address of first element .
since the indirection ***a gives the value. Hence, the first line of the output.
The second printf a+1 increases in the third dimension thus points to value at 114, *a+1 increments in second dimension thus points to 104, **a +1 increments the first dimension thus points to 102 and ***a+1 first gets the value at first location and then increments it by 1.

Workspace

NA
SHSTTON
29
Solv. Corr.
35
Solv. In. Corr.
64
Attempted
3 M:4 S
Avg. Time

10 / 60

What is the output of the following C Program?
#include<stdio.h>
int main(){
void *vp;
char ch = 'g', *cp = "goofy";
int j '= 20;
vp = &ch;
printf("%c", *(char *)vp);
vp = &j;
printf("%d",*(int *)vp);
vp = cp;
printf("%s",(char *)vp + 3);
}

Agoofy20

Bg20fy

Cgg20fy

DCompilation error

Explanation:

Since a void pointer is used it can be type casted to any other type pointer. vp = &ch stores address of char ch and the next statement prints the value stored in vp after type casting it to the proper data type pointer. the output is "g".
Similarly the output from second printf is "20". The third printf statement type casts it to print the string from the 4th value hence the output is "fy".

Workspace

## C Programming Pointers Questions and Answers pdf

At C Programming topic Pointers, you will get multiple online quiz difficulty wise, which will have a total of 6 quizzes, categorized as easy, medium, and moderate level. While preparing for any Pointers, take all the list quiz and check your preparation level for that topic. Each quiz have 10 different question, which needs to be answered in 20 min., all the listed quiz here is free, however, you will get only one chance for each quiz to attempt(Take Quiz seriously), so it is always recommended to take one quiz in each section before you start solving Pointers MCQs practice question, and one after solving all the question of the respective level, you can refer back your Pointers quiz result any time or you can download it as pdf for reference.

## C Programming Pointers Customize Online Mock Test

This is own type of mock test, where At this C Programming Pointers MCQs mock test section, you will able to attempt only the questions related to Pointers, in that question will be a different level, important, and all the questions will be part of some of the mock tests across Q4interview FREE Mock test. You need to choose the topic as Pointers, and click on Double click to generate your customize mock test. While attempting the mock test you need to choose any of the one options out of given option. It is recommended to go through the direction given along with each question, as these questions will be randomly and so that same direction will not be applicable across the entire test. Once you submit your mock test, the result will be generated for Pointers Customize mock test, where your performance point points will be highlighted. Q4interview analysis every single point which helps you to improve your topic understanding and help you to know your type of mistakes and way to improve Pointers questions, by providing the same type of practice questions from practice exercise. The best part of this Pointers, all these mock tests listed here are free and you can take as Many time, as many you want. When you continue to give Pointers Customize Online Mock Test here regularly, then you will understand how much you have developed your accuracy on a topic, after that you will be able to decide how much attention you need to focus on. Your continued practice will increase your confidence, speed and thinking ability intensely, the Pointers Customize topic on which you will practice more will beneficial for you in future during campus placement.

## C Programming Pointers Quiz Online Test

The details of the C Programming Pointers quiz are as follows. There are 10 questions for you. You have to answer them in 20 minutes. Within 20 minutes you have to see the errors in the sentences given as a question. Four options are also given to you, and you have to choose your opinion. You must be confident in your answer that the choices are difficult. Therefore, below we provide you with some information about C Programming Pointers that you see and keep them in mind while answering questions.

## C Programming Pointers MCQs Practice Questions with Answer

On this Pointers section of page you will find the easiest quickest ways to solve a question, formulas, shortcuts and tips and tricks to solve various easiest methods to solve Pointers Question Quickly. It contains all the C Programming topic Pointers questions which are common in any of the preliminary exams of any company. The solution is provided along with the questions. The practice of these questions is a must as they are easy as well as scoring and asked in all the exams They will confirm the selection if all the questions attempted wisely with little practice. It is recommanded to Take Mock test based on C Programming topic and Pointers topic based quiz.

## C Programming Pointers solved examples question

You can get here fully solved Pointers examples with a detailed answer and description. You can solve Pointers problems with solutions, the questions by companies wise by filtering the questions, additionally, you can check what type of questions are being asked in IT companies Written Round from Pointers. Pointers became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through Pointers Examples, Pointers sample questions. You can Evaluate your level of preparation in Pointers by Taking the Q4Interivew Pointers Online Mock Test based on most important questions. All the Pointers practice questions given here along with answers and explanations are absolutely free, you can take any number of time any mock Test.

## Why C Programming Pointers?

In this practice section, you can practice C Programming Questions based on "Pointers" and improve your skills in order to face the interview, competitive examination, IT companies Written exam, and various other entrance tests (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

## Where can I get C Programming Pointers questions and answers with explanation?

Q4Interview provides you lots of fully solved C Programming (Pointers) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. You can download C Programming Pointers quiz questions with answers as PDF files and eBooks.

## Where can I get C Programming Pointers Interview Questions and Answers (objective type, multiple-choice, quiz, solved examples)?

Here you can find objective type C Programming Pointers questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.