NIOS Class 12 Computer Science Chapter 17 Structure, Typedef & Enumerated Data Type Solutions English Medium As Per New Syllabus. to each chapter is provided in the list so that you can easily browse throughout different chapters NIOS Class 12 Computer Science Chapter 17 Structure, Typedef & Enumerated Data Type Notes and select need one. NIOS Class 12 Computer Science Question Answers Download PDF. NIOS Study Material of Class 12 Computer Science Notes Paper 330.
NIOS Class 12 Computer Science Chapter 17 Structure, Typedef & Enumerated Data Type
Also, you can read the NIOS book online in these sections Solutions by Expert Teachers as per National Institute of Open Schooling (NIOS) Book guidelines. These solutions are part of NIOS All Subject Solutions. Here we have given NIOS Class 12 Computer Science Textbook Solutions, NIOS Senior Secondary Course Computer Science Notes for All Chapter, You can practice these here.
Structure, Typedef & Enumerated Data Type
Chapter: 17
| Module – 3: Programming in C++ |
INTEXT QUESTIONS 17.1
Fill in the blanks:
1. Structure is a collection of simple variables which can be of ______________ .
Ans: Same or different types.
2. Typedef is used to define ______________ for an existing data type.
Ans: A new name (alias).
3. ______________ is the syntax of accessing data members of the structure.
Ans: Dot (.) operator.
4. What will be the output of the following programs.
(a) # include < iostream.h >
void main ( )
{
struct rollno { int roll; };
rollno r;
r. roll = 100;
cout << “roll = ” << r. roll;
}
Ans: Roll = 100.
(b) # include < iostream.h >
void main ( )
{
struct student
{
int roll;
int age; };
student S1 = { 100, 15 };
student S2 = S1;
if ( S1 = = S2 )
cout << “The structures are equal”;
else
cout << “The structures are not equal”;
Ans: The structure are equal.
INTEXT QUESTIONS 17.2
1. What is the meaning of the following statement? enum days { sun, mon, tue };
Ans: Sun = 0,
mon = 1,
tue = 2
2. Can the enum data input by the user?
Ans: Yes, enum values can be input indirectly using integers.
3. (a) Write a statement that declares an enumerated data type called months with the values jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
Ans: enum months { jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec };
(b) Define two variables m1 and m2 and assign them the values jan and mar respectively.
Ans: Months m1, m2;
m1 = jan;
m2 = mar;
4. Write a statement that declares an enumerated data type called colour with the values pink, red, green, and blue. Give these four names the integer values 33, 45, 58 and 78.
Ans: enum colour {pink = 33, red = 45, green = 58, blue = 78 };
TERMINAL EXERCISE
1. What is a structure? Write a structure specification in C++ for the record given below:
Code: A string of 5 characters (including null)
Cost: Integer
Margin: Integer
Call this structure item.
Ans: A structure is a collection of simple variables which can be of same or different types. It is a user defined datatype which allows you to combine different data types to store a particular type of record.
struct item
{
char code[5];
int cost;
int margin;
};
Subject Ka Complete Video Solution Dekhein
Step-by-step easy concept explanation aur full questions Answer ke liye watch karein ya app download karein:

