You can Download Chapter 14 Structures Questions and Answers, Notes, 1st PUC Computer Science Question Bank with Answers Karnataka State Board Solutions help you to revise complete Syllabus and score more marks in your examinations.

Karnataka 1st PUC Computer Science Question Bank Chapter 14 Structures

1st PUC Computer Science Structures One Mark Questions and Answers

Question 1.
Define structure.
Answer:
A structure is a collection of variables which can be of the same or different types.

Question 2.
What is the use of structures?
Answer:
Structures can be used to handle a group of logically related data items like register number, student name, subject marks, etc., under a single name.

KSEEB Solutions

Question 3.
What is the purpose of a struct keyword?
Answer:
It is the reserved or keyword, used in structure definition.

Question 4.
What is a structure tag?
Answer:
Structure tag is a name given by the programmer and used to identify the structure during future re-definitions.

Question 5.
What is a structure template?
Answer:
The list of all the structure members is called a template.

Question 6.
What purpose does structure definition serve?
Answer:
The structure definition acts as a blueprint for the creation of variables.

Question 7.
How is a member of a structure accessed?
Answer:
The member of the structure is accessed by using the dot (.) operator.

KSEEB Solutions

Question 8.
Write the declaration syntax for a structure variable.
Answer:
The general syntax for declaration of structure variable is Structurename variable;

Question 9.
Define nested structures.
Answer:
When a structure is defined as a member of another structure the embedded structure is called a nested structure.

Question 10.
What is an array of structures?
Answer:
Array of structure is a collection of array elements in which, each element of the array is a structure.

1st PUC Computer Science Structures Two/Three Marks Questions and Answers

Question 1.
Give the difference between array and structure.
Answer:
An array is a collection of similar data elements under a single name whereas structure is a collection of dissimilar data elements under a single name.

Question 2.
Give the declaration of structure.
Answer:
struct <structure-tag>
{
<data_type> <member variablel>
<data_type> < member variable2> list of members
<data_type> < member variable3>
} <structure-variable-name 1>, <structure-variable-name2>;

Question 3.
Write the structure definition to store name of the student, register number, class.
Answer:
struct student
{
int SP regno;
char name[50];
char class[6];
};

KSEEB Solutions

Question 4.
How is a structure initialized? Give an example.
Answer:
Initialization is done at the time of declaration of a variable. For example
Student S2 = {100,17,”Aniket”,92};

Question 5.
How are structure members accessed? Give an example.
Answer:
The accessing of data of the members is done by using the following format:
structure variable.member name
for example cin>>s1.rollno>>s1.age>>s1.name>>s1.marks;

Question 6.
How is an array of structure declared? Give an example.
Answer:
The array of structure is a collection of array elements in which each element is a structure in the array.
For example,
struct student
{
int regno;
char name [50];
char class [6];
} s[100];

1st PUC Computer Science Structures Five Marks Questions and Answers

Question 1.
Explain the elements of structure definition. Give an example.
Answer:
struct <structure-tag>
{
<data_type> <member variable 1>
<data_type> < member variable2> list of members
<data_type> < member variable3>
} <structure-varable-namel>, <structure-varable-name2>;
1. struct:
It is the reserved or keyword used in structure definition.

2. <structure-tag>:
It is the name given by the programmer and used to identity the structure in future re-definitions. They are used to declare structure variables.

3. <data-type>:
Any valid data type in ‘C’.

4. < member variable 1…4>:
are names of the variables.

5. <structure-variable-name 1 ,.2>:
It is used to access the members of the structure.
Example:
struct student
{
int SP regno;
char name[20];
char class[5];
char combination[4];
float fees;
} st1, st2, st3;

KSEEB Solutions

Question 2.
Write the different methods of structure initialization.
Answer:
A struct variable can be initialized, like any other data variables in C++, at the time it is declared. We could use:
struct student {
char name[20];
int regno;
float fees;
} s1 = {“ram”, 25,24000.50};
or
student s1 = {“ram”, 25,24000.50};

Question 3.
Explain the nesting of structures with an example.
Answer:
A structure defined as a member of another structure is called a nested structure.
Example of a nested structure:
struct date
{
int  day;
int  month;
int  year;
};
struct student
{
int regno;
char name[20];
char class[10];
struct date dob;
struct date admission date;
}st1, st2, st3;
In the above example, st1, st2, and st3 are the structure variable of type student and date is a structure definition. The members of student structure are regno, is an integer data type, name and class which are char type and dob admission date are date structure type variable members. The dob and admission date are and the structure variable who are members of another structure.

KSEEB Solutions

Question 4.
Explain the use of an array of structures with an example.
Answer:
The use of arrays in the place of normal structure variables refers to the array of structure, i.e., if we want to store different values of regno, name, class, etc., for 100 students then we need a structure and 100 different structure variable names. The creation of 100 different variables can be avoided using an array.
For example; if we use thenormal method of storing values for student structure type then we need 10 structure variables with unique name.
struct student
{
int regno;
char name[20];
char class[5];
char combination[4];
float fees;
} st1, st2, st3, st4, st5, …………………st100;
This waste of usage can be avoided by declaring an array variable in that place in the following manner
Example:
struct student
{
int regno;
char name [20];
char class[5];
charcombination[4];
float fees;
} st[100]; → st[100] is array variable