Topic: Chapter 12: Arrays and Structures (Test 1)



Topic: Chapter 12: Arrays and Structures
Q.1
Which of the following is the collection of variables of the same type that an referenced by a common name ?
A. int
B. float
C. Array
D. class
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.2
Array subscripts is always starts with which number ?
A. -1
B. 0
C. 2
D. 3
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.3
int age[]={6,90,20,18,2}; How many elements are there in this array?
A. 2
B. 5
C. 6
D. 4
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.4
cin>>n[3]; To which element does this statement accepts the value?
A. 2
B. 3
C. 4
D. 5
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.5
By default, the string and with which character?
A. \o
B. \t
C. \n
D. \b
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.6
The data elements in the structure are also known as
A. objects
B. members
C. data
D. records
Answer : Option B
Explaination / Solution:
No Explaination.


Workspace
Report
Q.7
Structure definition is terminated by
A. :
B. }
C. ;
D. ::
Answer : Option C
Explaination / Solution:
No Explaination.


Workspace
Report
Q.8
What will happen when the structure is declared?
A. it will not allocate any memory
B. it will allocate the memory
C. it will be declared and initialized
D. it will be only declared
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.9

What is the output of this program?

#include <iostream>

#include <string.h>

using namespace std;

int main()

{

 struct student

 {

 int n;

 char name[10];

 };

 student s;

 s.n = 123;

 strcpy(s.name, "Balu");

 cout<<s.n;

 cout<< s.name <<endl;

return 0; }

A. 123Balu
B. BaluBalu
C. Balu123
D. 123 Balu
Answer : Option A
Explaination / Solution:
No Explaination.


Workspace
Report
Q.10

A structure declaration is given below.

struct Time

{

int hours;

int minutes;

int seconds;

}t;

Using above declaration which of the following refers to seconds.

A. Time.seconds
B. Time::seconds
C. seconds
D. t. seconds
Answer : Option D
Explaination / Solution:
No Explaination.


Workspace
Report