[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
18
Solv. Corr.
48
Solv. In. Corr.
66
Attempted
0 M:0 S
Avg. Time

11 / 55

What will be output of the following "c" code?
#include<stdio.h>
int main(){
static int a[][2][3]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int i=-1;
int d;
d=a[i++][++i][++i]; printf("%d",d); return 0;
}

A9

B10

C11

D12

ECompilation error

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
38
Solv. Corr.
21
Solv. In. Corr.
59
Attempted
0 M:0 S
Avg. Time

12 / 55

What is the output of the following 'C' program ?
#include<stdio.h>
void main()
{
char str [7] = "Chennai";
printf("%s", str);
}

AError

BCannot predict

CChennai

DNone of these

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
23
Solv. Corr.
33
Solv. In. Corr.
56
Attempted
0 M:0 S
Avg. Time

13 / 55

What is the following 'C' program doing?
#include<stdio.h>
void main ()
{
unsigned int m[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
unsigned char n, i;
scanf("%d", &n);
for (i=0; i <= 7; i++)
{
if(n & m[i])
printf("\nyes");
}}

APutting off all bits which are on in the number n

BTesting whether the individual bits of n are on or off

CThis program would give an error

DNone of these

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
17
Solv. Corr.
36
Solv. In. Corr.
53
Attempted
0 M:0 S
Avg. Time

14 / 55

What will be the output of the program ?
#include<stdio.h>
void main( )
{
int a[] = {10,20,30,40,50},j,*p;
for(j=0; j<5; j++)
{
printf("%d" ,*a);
a++;
}
p = a;
for(j=0; j<5; j++)
{
printf("%d " ,*p);
p++;
}
}

ACompiler error: lvalue required.

BNo Error

C10 20 30 40 50 10 20 30 40 50

DNone of these

Answer: Option A

Explanation:

Error is in line with statement a++.
The operand must be an lvalue and may be of any of scalar type for the any operator, array name only when subscripted is an lvalue. Simply array name is a non-modifiable lvalue.

Workspace

NA
SHSTTON
18
Solv. Corr.
46
Solv. In. Corr.
64
Attempted
0 M:0 S
Avg. Time

15 / 55

What will be the output of the program ?
#include<stdio.h>
void main ( )
{
static char *s[] = {"black", "white", "yellow", "violet"};
char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
**++p;
printf("%s",*--*++p + 3);
}

Abk

Bmk

Cgk

Dck

ECompilation Error

Answer: Option D

Explanation:

an "array of char pointers" pointing to start of 4 strings.
Then we have ptr which is a pointer to a pointer of type char and a variable p which is a pointer to a pointer to a pointer of type char.
p hold the initial value of ptr, i.e. p = s+3. The next statement increment value in p by 1 , thus now value of p = s+2. In the printf statement the expression is evaluated *++p causes gets value s+1 then the pre decrement is executed and we get s+1-1 = s. the indirection operator now gets the value from the array of s and adds 3 to the starting address. The string is printed starting from this position.
=> The output is 'ck'.

Workspace

NA
SHSTTON
10
Solv. Corr.
41
Solv. In. Corr.
51
Attempted
0 M:31 S
Avg. Time

16 / 55

What will be the output of the program ?
#include<stdio.h>
void main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8}  };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d..%d \n",*p,*q);
}

A8 … 1

B4 … 1

CCompilation Error

Dgarbage value..1

Answer: Option D

Explanation:

p=&a[2][2][2] you declare only two 2D arrays.
but you are trying to access the third 2D(which you are not declared) it will print garbage values.
*q=***a starting address of a is assigned integer pointer. now q is pointing to starting address of a.if you print *q meAnswer:it will print first element of 3D array.

Workspace

NA
SHSTTON
12
Solv. Corr.
31
Solv. In. Corr.
43
Attempted
0 M:0 S
Avg. Time

17 / 55

What will be the output of the program ?
#include<stdio.h>
void abc(char a[]);
void main(){
char a[100];
a[0]='a';
a[1]='b';
a[2]='c';
a[4]='d';
abc(a);
}
void abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
}

Aac

Bcd

CCompilation Error

Dbc

Answer: Option D

Explanation:

The base address is modified only in function and as a result a points to 'b' then after incrementing to 'c'
=> bc will be printed.

Workspace

NA
SHSTTON
20
Solv. Corr.
25
Solv. In. Corr.
45
Attempted
0 M:0 S
Avg. Time

18 / 55

What will be the output of the program ?
#include<stdio.h>
void main()
{
int arr2D[3][3];
printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) );
}

A0

BGarbage Value

C1

DCompilation Error

ENone of these

Answer: Option C

Explanation:

This is due to the close relation between the arrays and pointers.
N dimensional arrays are made up of (N-1) dimensional arrays.
arr2D is made up of a 3 single arrays that contains 3 integers each .
arr2D arr2D[1] arr2D[2] arr2D[3]

The name arr2D refers to the beginning of all the 3 arrays. *arr2D refers to the start of the first 1D array (of 3 integers) that is the same address as arr2D. So the expression (arr2D == *arr2D) is true (1). Similarly, *arr2D is nothing but *(arr2D + 0), adding a zero doesn't change the value/meaning. Again arr2D[0] is the another way of telling *(arr2D + 0). So the expression (*(arr2D + 0) == arr2D[0]) is true (1).
Since both parts of the expression evaluates to true the result is true.

Workspace

NA
SHSTTON
11
Solv. Corr.
32
Solv. In. Corr.
43
Attempted
0 M:0 S
Avg. Time

19 / 55

What will be the output of the program ?
#include<stdio.h>
void main()
{
char p[ ]="%d\n"; 
p[1] = 'c'; 
printf(p,65);
}

A65

BB

CCompilation Error

DA

ENone of these

Answer: Option D

Explanation:

Due to the assignment p[1] = 'c' the string becomes, "%c\n".
Since this string becomes the format string for printf and ASCII value of 65 is 'A'.

Workspace

NA
SHSTTON
17
Solv. Corr.
21
Solv. In. Corr.
38
Attempted
0 M:0 S
Avg. Time

20 / 55

What will be the output of the program ?
#include<stdio.h>
#include<string.h>
void main()
{
char *p="GOOD";
char a[ ]="GOOD";
printf("\n  sizeof(p)  =  %d,  sizeof(*p)  =  %d,  strlen(p)  =  %d",  sizeof(p), sizeof(*p), strlen(p));
printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); 
}

Asizeof(p) = 4, sizeof(*p) = 1, strlen(p) = 4, sizeof(a) = 5, strlen(a) = 4

Bsizeof(p) = 3, sizeof(*p) = 2, strlen(p) = 4 sizeof(a) = 5, strlen(a) = 2

Csizeof(p) = 2, sizeof(*p) = 1, strlen(p) = 4 sizeof(a) = 5, strlen(a) = 4

DCompilation Error

ENone of these

Answer: Option A

Explanation:

sizeof(p) => sizeof(char*) => 2 sizeof(*p) => sizeof(char) => 1
Similarly,

sizeof(a) => size of the character array => 5

When sizeof operator is applied to an array it returns the sizeof the array and it is not the same as the sizeof the pointer variable. Here the sizeof(a) where a is the character array and the size of the array is 5 because the space necessary for the terminating NULL character should also be taken into account.

Workspace

C Programming Arrays Questions and Answers pdf

At C Programming topic Arrays page No: 2 you will find list of 10 practice questions, tips/trick and shortcut to solve questions, solved questions, quiz, and download option to download the whole question along with solution as pdf format for offline practice. You can practice all the listed C Programming Arrays topic questions offline too, by downloading the MCQs practice question of Arrays with detail solution, with formula/Tips & Tricks, with Solved examples and with top-rated users answers, which will give you best answer ascross webs. It is one of the perfect Arrays e-book pdf covering all types of questions in detail. These C Programming test with answers pdf cover all types of question asked in IIFT, XAT, SNAP, GRE, GMAT, NMAT, CMAT, MAT or for IT companies written exam like Wipro, HCL, Infosys, Accenture, Government exams, IBPS Exams etc. There are multiple formats to download your online free C Programming Arrays e-book, like fully solved, unsolved questions with Answers sheet. Even you can customize your ebook format by adjusting the given options in the download section to make it your one of the best C Programming topic-based ebook. It is recommended to bookmark this page C Programming Arrays for your preparation. Most of the students and fresher candidates finding it hard to clear the C Programming section in exams. Here Given Arrays practice questions, quiz, fully solved questions, tips & trick and Mock tests, which include question from each topic will help you to excel in Arrays. Each test has all the basics questions to advanced questions with answer and explanation for your clear understanding, you can download the test result as pdf for further reference.

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.Arrays Mock Tests

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

Clarity of concepts is a must if you want to master the skill of solving C Programming problems. This page contains sample C Programming Arrays questions and answers for freshers and competitive exams. Arrays Questions with the detailed description, the explanation will help you to master the topic. Here solved examples with detailed answer description, explanations are given and it would be easy to understand. How to solve qArraysC Programming? Here are some examples solved with the Common Rules/tricks/tips of C Programming. Enhance your chance to score maximum marks in C Programming sections through. Error Spotting Grammar Questions Online Test for Free. Fully solved Sentence Formation MCQs questions with detailed answer description. C Programming is an important topic for any exams but most aspirants find it difficult. You need to learn various tricks tips, rules, etc to solve quickly. At this page, you will find frequently asked Arrays questions or problems with solutions, shortcuts, formulas for all-important competitive exams like IT companies exams, interviews. It is always a best practice to go through the example and understand the types of question and way to solve it, so let's do some examples to calculate efficiency, read through all the given here solved examples. You can post your solution, tips, trick and shortcut if you have any in respect to questions.

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.