[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.

# Arrays Questions

Home > Technical Aptitude > C Programming > Arrays > General Questions
NA
SHSTTON
50
Solv. Corr.
75
Solv. In. Corr.
125
Attempted
0 M:0 S
Avg. Time

1 / 55

What is the output of the following problem ?
#include<stdio.h>
int main()
{
func(1);
return 0;
}
func(int  i){
static char *str[] = {"One","Two", "Three", "Four"};
printf("%s\n",str[i++]);
return;
}

AOne

BTwo

CThree

Dwo

ESegmentation fault

Explanation:

Here, in main() first func(1) will be called, since char is static in func(int i) after first increment it goes to another index i.e. "Two" so, it will get printed.

Workspace

NA
SHSTTON
55
Solv. Corr.
54
Solv. In. Corr.
109
Attempted
0 M:4 S
Avg. Time

2 / 55

What will be the output of the program ?
#include<stdio.h>
int  main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
return 0;
}

Asegmentation falult

Bmmmm aaaa nnnn

CCompiler Error

DNone of these

Explanation:

s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, in directing it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as s[i].

Workspace

NA
SHSTTON
26
Solv. Corr.
80
Solv. In. Corr.
106
Attempted
0 M:0 S
Avg. Time

3 / 55

What will be the output of the program ?
#include<stdio.h>
int main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
return 0;
}

A2 5 5

B2 4 4

C2 5 4

D2 4 5

ENone of these

Explanation:

In first sizeof, str1 is a character pointer so it gives you the size of the pointer variable.
In second sizeof the name str2 indicates the name of the array whose size is 5 (including the '\0' termination character).
The third sizeof is similar to the second one.

Workspace

NA
SHSTTON
49
Solv. Corr.
107
Solv. In. Corr.
156
Attempted
0 M:0 S
Avg. Time

4 / 55

What will be the output of the program ?
#include<stdio.h>
int main() {
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
return 0;
}

A88

B76

C77

D98

ENone of these

Explanation:

p is pointing to character '\n'. str1 is pointing to character 'a' ++*p. "p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10, which is then incremented to 11.
The value of ++*p is 11. ++*str1, str1 is pointing to 'a' that is incremented by 1 and it becomes
'b'. ASCII value of 'b' is 98.
Now performing (11 + 98 - 32), we get 77("M"); So we get the output 77 :: "M" (Ascii is 77).

Workspace

NA
SHSTTON
6
Solv. Corr.
54
Solv. In. Corr.
60
Attempted
0 M:0 S
Avg. Time

5 / 55

What is the output of the following C Program?
#include<stdio.h>
#define max 5
#define int arr1[max]
int main()
{
typedef char arr2[max];
arr1 list={0,1,2,3,4};
arr2 name="name";
printf("%d %s",list[0],name);
return 0;
}

A0 name

BGarbage Value

C1 name

DCompilation error

Explanation:

#defines are used for textual replacement whereas typedefs are used for declaring new types.

Workspace

NA
SHSTTON
30
Solv. Corr.
40
Solv. In. Corr.
70
Attempted
2 M:9 S
Avg. Time

6 / 55

What is the output of the following C Program?
#include<stdio.h>
int main()
{
int i; char *t; t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
return 0;
}

CCompiler error: incompatible types in assignment

DNone of these

Explanation:

Array names are pointer constants. So it cannot be modified.

Workspace

NA
SHSTTON
81
Solv. Corr.
219
Solv. In. Corr.
300
Attempted
0 M:14 S
Avg. Time

7 / 55

What is the output of the following C Program?
#include<stdio.h>
void main()
{
int a[10];
printf("%d",*a+1-*a+3);
}

A2

B4

C5

D1

ECompilation Error

Explanation:

*a and -*a cancels out. The result is as simple as 1 + 3 = 4 !

Workspace

NA
SHSTTON
38
Solv. Corr.
197
Solv. In. Corr.
235
Attempted
0 M:0 S
Avg. Time

8 / 55

What will be output of the following "c" code?
#include<stdio.h>
int main(){
int arr[]={6,12,18,24};
int x=0;
x=arr[1]+(arr[1]=2);
printf("%d",x); return 0;
}

A4

B8

C14

D14

ECompilation error

Explanation:

## So, 4 will be printed.

Workspace

NA
SHSTTON
38
Solv. Corr.
75
Solv. In. Corr.
113
Attempted
0 M:0 S
Avg. Time

9 / 55

What will be output of the following "c" code?
#include<stdio.h>
int main(){
int arr[3]={10,20,30};
int x=0;
x=++arr[++x]+ ++x+arr[--x];
printf("%d ",x);
return 0;
}

A23

B43

C22

D44

ECompilation error

Explanation:

44 is correct

Workspace

NA
SHSTTON
75
Solv. Corr.
79
Solv. In. Corr.
154
Attempted
0 M:0 S
Avg. Time

10 / 55

What will be output of the following "c" code?
#include<stdio.h>
int main(){
int a[]={10,20,30,40};
int i=3,x;
x=1*a[--i]+2*a[--i]+3*a[--i];
printf("%d",x);
return 0;
}

A60

B50

C40

D30

ECompilation error

Explanation:

I think so the ans should 100

Workspace

## C Programming Arrays Questions and Answers pdf

At C Programming topic Arrays, 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 Arrays, 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 Arrays MCQs practice question, and one after solving all the question of the respective level, you can refer back your Arrays quiz result any time or you can download it as pdf for reference.

## C Programming Arrays Customize Online Mock Test

This is own type of mock test, where At this C Programming Arrays MCQs mock test section, you will able to attempt only the questions related to Arrays, 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 Arrays, 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 Arrays 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 Arrays questions, by providing the same type of practice questions from practice exercise. The best part of this Arrays, all these mock tests listed here are free and you can take as Many time, as many you want. When you continue to give Arrays 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 Arrays Customize topic on which you will practice more will beneficial for you in future during campus placement.

## C Programming Arrays Quiz Online Test

The details of the C Programming Arrays 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 Arrays that you see and keep them in mind while answering questions.

## C Programming Arrays MCQs Practice Questions with Answer

On this Arrays 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 Arrays Question Quickly. It contains all the C Programming topic Arrays 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 Arrays topic based quiz.

## C Programming Arrays solved examples question

You can get here fully solved Arrays examples with a detailed answer and description. You can solve Arrays 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 Arrays. Arrays became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through Arrays Examples, Arrays sample questions. You can Evaluate your level of preparation in Arrays by Taking the Q4Interivew Arrays Online Mock Test based on most important questions. All the Arrays 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 Arrays?

In this practice section, you can practice C Programming Questions based on "Arrays" 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 Arrays questions and answers with explanation?

Q4Interview provides you lots of fully solved C Programming (Arrays) 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 Arrays quiz questions with answers as PDF files and eBooks.

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

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