Previous Questions and answers
Chapter 2 Arrays

1.Accessing each element of an array atleast once to perfom any operation is known as --------(March 2020 Score 1)




2. Consider the following declaration
int arr[5]={1,5,8,3,19};
a. Write the value of arr[3];
b. What will be the value of arr[4]-5; (March 2020 Score 2)



3. Write appropriate array declaration for the following (March 2020 Score 3)
(a)to store height of 10 students in a class
(b)to store name of your school
(c)to store age of 50 students



4.What are the differences in string handling using cin and gets( ) in C++ programs?(June 2019 score 2)



5. (a) Define an array. (June 2019 Score 3)
(b) Write C++ statement to declare a character array of size20.
(c) Write C++ statement to store the string "Welcome" in the same array.



6. _____ character is stored at the end of the string. (March 2019 score1)



7. i) Define an Array.
(ii) Initialize an integer array with 5 elements. March 2019 Score 2



8. Write a program in C++ to accept a string with white space like "good morning" from the keyboard and display the same (March 2019 Score 3)



9. Consider the following C++ code :
(a) char name[20];
cin>>name;
cout<<name;
(b) char name[20];
gets(name);
cout<<name;
Write the answers in both cases if the string entered value is “NEW DELHI”. Justify your answer. (June 2018 score 3)



10. Define array traversal with an example. (June 2018 Score 3)



11. Write a C++ statement to declare an array with size 25 to accept the name of a student. (March 2018 Score 1)



12. Consider the following C++ code
int main( )
{
char str [20];
cout<<"Enter a String" ;
cin >>str;
puts(str);
return 0;
}
a) Write the value of str if the string "HELLO WORLD", is input to the code. Justify.
b) Write the amount of memory allocated for storing the array str. Give reason.
c) Write an alternative we can use to input string in place of cin.	(March 2018 Score 5)