Home | | Computer Science 11th std | Choose the correct answer

Arrays and Structures | Computer Science - Choose the correct answer | 11th Computer Science : Chapter 12 : Arrays and Structures

Chapter: 11th Computer Science : Chapter 12 : Arrays and Structures

Choose the correct answer

Multiple choice questions with answers / choose the correct answer with answers - Computer Science Book back 1 mark questions and answers - Computer Science : Introduction of C++: Arrays and Structures

Introduction of C++

Arrays and Structures

Evaluation

PART – I

 

Choose the correct answer

 

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

 

2. Array subscripts is always starts with which number ?

a)-1

b) 0

c) 2

d) 3

 

3. int age[]={6,90,20,18,2}; How many elements are there in this array?

a) 2

b) 5

c) 6

d) 4

 

4. cin>>n[3]; To which element does this statement accepts the value?

a) 2

b) 3

c) 4

d) 5

 

5. By default, the string and with which character?

a) \o

b) \t

c) \n

d) \b

 

Structures

 

Choose the correct answer

 

1. The data elements in the structure are also known as

(a) objects

(b) members

(c) data

(d) records

 

2. Structure definition is terminated by

(a) :

(b) }

(c) ;

(d) ::

 

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

 

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

 

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

 

6. What will be the output of this program?

#include <iostream>

using namespace std;

struct ShoeType

{

string name;

double price;

};

int main()

{

ShoeType shoe1, shoe2;

shoe1.name = "Adidas";

shoe1.price = 9.99;

cout<< shoe1.name<< " # "<< shoe1.price<<endl;

shoe2 = shoe1;

shoe2.price = shoe2.price / 9;

cout<< shoe2.name<< " # "<< shoe2.price;

return 0;

(a) Adidas # 9.99

Adidas # 1.11

(b) Adidas # 9.99

Adidas # 9.11

(c) Adidas # 9.99

Adidas # 11.11

(d) Adidas # 9.11

Adidas # 11.11

 

7. Which of the following is a properly defined structure?

(a) struct {int num;}

(b) struct sum {int num;}

(c) struct sum int sum;

(d) struct sum {int num;};

 

8. A structure declaration is given below.

struct employee

{

int empno;

char ename[10];

}e[5];

Using above declaration which of the following statement is correct.

(a) cout<<e[0].empno<<e[0].ename;

(b) cout<<e[0].empno<<ename;

(c) cout<<e[0]->empno<<e[0]->ename;

(d) cout<<e.empno<<e.ename;

 

9. Which of the following cannot be a structure member?

(a) Another structure

(b) Function

(c) Array

(d) variable of double datatype

 

10. When accessing a structure member ,the identifier to the left of the dot operator is the name of

(a) structure variable

(b) structure tag

(c) structure member

(d) structure function

 

Tags : Arrays and Structures | Computer Science , 11th Computer Science : Chapter 12 : Arrays and Structures
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 12 : Arrays and Structures : Choose the correct answer | Arrays and Structures | Computer Science


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.