Click To Get Off-Campus Placement Jobs Info !!!

C Programming :: Arrays

Home > Technical Aptitude > C Programming > Arrays > General Questions
NA
SHSTTON
9
Solv. Corr.
13
Solv. In. Corr.
22
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

Answer: Option B

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
12
Solv. Corr.
12
Solv. In. Corr.
24
Attempted
0 M:0 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

Answer: Option B

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
6
Solv. Corr.
15
Solv. In. Corr.
21
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

Answer: Option A

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
3
Solv. Corr.
12
Solv. In. Corr.
15
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

Answer: Option C

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
0
Solv. Corr.
1
Solv. In. Corr.
1
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

Answer: Option D

Explanation:

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

Workspace

NA
SHSTTON
4
Solv. Corr.
7
Solv. In. Corr.
11
Attempted
0 M:0 S
Avg. Time

6 / 55

What is the output of the following C Program?
#include<stdio.h>
int main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
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;
}

Apascal ada cobol fortran perl

Bpascal ada cobol

CCompiler error: incompatible types in assignment

DNone of these

Answer: Option C

Explanation:

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

Workspace

NA
SHSTTON
19
Solv. Corr.
39
Solv. In. Corr.
58
Attempted
0 M:11 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

Answer: Option B

Explanation:

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

Workspace

NA
SHSTTON
3
Solv. Corr.
9
Solv. In. Corr.
12
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

Answer: Option A

Explanation:

x=arr[1]+(arr[1]=2); arr[1] gets modified here itself.

So, 4 will be printed.

Workspace

NA
SHSTTON
6
Solv. Corr.
12
Solv. In. Corr.
18
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

Answer: Option B

Explanation:

44 is correct 

Workspace

NA
SHSTTON
9
Solv. Corr.
8
Solv. In. Corr.
17
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

Answer: Option A

Explanation:

I think so the ans should 100

Workspace

C Programming Arrays Questions and Answers pdf

At C Programming topic Arrays page No: 1 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.