Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Accountancy Guide Pdf Chapter 4 Ledger Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Accountancy Solutions Chapter 4 Ledger

11th Accountancy Guide Ledger Text Book Back Questions and Answers

I. Choose the correct answer.

Question 1.
Main objective of preparing ledger account is to ………………..
(a) Ascertain the financial position
(b) Ascertain the profit or loss
(c) Ascertain the profit or loss and the financial position
(d) Know the balance of each ledger account
Answer:
(d) Know the balance of each ledger account

Question 2.
The process of transferring the debit and credit items from journal to ledger accounts is called ………….
(a) Casting
(b) Posting
(c) Journalising
(d) Balancing
Answer:
(b) Posting

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 3.
J.F means
(a) Ledger page number
(b) Journal page number
(c) Voucher number
(d) Order number
Answer:
(b) Journal page number

Question 4.
The process of finding the net amount from the totals of debit and credit columns in a ledger is known as ……………
(a) Casting
(b) Posting
(c) Journalising
(d) Balancing
Answer:
(d) Balancing

Question 5.
If the total of the debit side of an account exceeds the total of its credit side, it means
(a) Credit balance
(b) Debit balance
(c) Nil balance
(d) Debit and credit balance
Answer:
(b) Debit balance

Question 6.
The amount brought into the business by the proprietor should be credited to
(a) Cash account
(b) Drawings account
(c) Capital account
(d) Suspense account
Answer:
(c) Capital account

II. Very Short Answer Type Questions

Question 1.
What is a ledger?
Answer:
Ledger account is a summary statement of all the transactions relating to a person, asset, liability, expense or income which has taken place during a given period of time and it shows their net effect From the transactions recorded in the journal, the ledger account is prepared. Ledger is known as principal book of accounts. It is a book which contains all sets of accounts, namely, personal, real and nominal accounts. Account wise balance can be determined from the ledger. The ledger accounts are prepared based on journal entries passed.

Question 2.
What is meant by posting?
Answer:
The process of transferring the debit and credit items from the journal to the ledger accounts is called posting.

Question 3.
What is debit balance?
Answer:
If the total on the debit side of an account is higher, the balancing figure is debit balance.

Question 4.
What is credit balance?
Answer:
If the credit side of an account has higher total, the balancing figure is credit balance.

Question 5.
What is balancing of an account?
Answer:
Balancing means that the debit side and credit side amounts are totalled and the difference between the total of the two sides is placed in the amount column as ‘Balance c/d’ on the side having lesser total, so that the total of both debit and credit columns are equal.

When the total of the debit side is more than the total of credit side the difference is debit balance and is placed on the credit side as ‘By Balance c/d’. If the credit side total is more than the total of debit side, the difference is credit balance and is placed on the debit side as ‘To Balance c/d’.

III. Short Answer Questions

Question 1.
Distinguish between journal and ledger.
Answer:
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 1a

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 2.
What is ledger? Explain its utilities.
Answer:
1. Ledger account is a summary statement of all the transactions relating to a person, asset, liability, expense or income which has taken place during a given period of time and it shows their net effect.
2. It is a book which contains all sets of accounts, namely, personal, real and nominal accounts.
3. Account wise balance can be determined from the ledger.
4. The ledger accounts are prepared based on journal entries passed.

Quick information about a particular account:
Ledger account helps to get all information about a particular account like sales, purchases, machinery, etc., at a glance.

For example, where there are several transactions with a debtor, the net amount due from a debtor can be known from the ledger account.

Control over business transactions:
From the ledger balances extracted, a thorough analysis of account balances can be made which helps to have control over the business transactions.

Trial balance can be prepared:
With the balances of ledger accounts, trial balance can be prepared to check the arithmetical accuracy of entries made in the journal and ledger.

Helps to prepare financial statements:
From the ledger balances extracted, financial statements can be prepared for ascertaining net profit or loss and the financial position.

Question 3.
How is posting made from, the journal to the ledger?
Answer:
The process of transferring the debit and credit items from the journal to the ledger accounts is called posting. The procedure of posting from journal to ledger is as follows:
1. Locate the ledger account that is debited in the journal entry. Open the respective account in the ledger, if already not opened. Write the name of the account in the top middle. If already opened, locate the account from the ledger index. Now entries are to be made on the debit side of the account.

2. Record the date of the transaction in the date column on the debit side of that account.

3. Record the name of the account credited in the journal with the prefix ‘To’ in particulars column.

4. Record the amount of the debit in the ‘amount column’.

5. Locate the ledger account that is credited in the journal entry. Open the respective account in the ledger, if already not opened. Write the name of the account in the top middle. If already opened, locate the account from the ledger index. Now entries are to be made on the credit side of the account. Record the date of the transaction in the date column. Record the name of the account debited in the journal entry in the particulars column with the prefix ‘By’ and write the amount in the amount column.

Question 4.
Explain the procedure for balancing a ledger account.
Answer:
1. The debit and credit columns of an account are to be totalled separately.

2. The difference between the two totals is to be ascertained.

3. The difference is to be placed in the amount column of the side having lesser total. ‘Balance c/d’ is to be entered in the particulars column against the difference and in the date column the last day of the accounting period is entered.

4. Now both the debit and credit columns are to be totalled and the totals will be equal. The totals of both sides are to be recorded in the same line horizontally. The total is to be distinguished from other figures by drawing lines above and below the amount.

5. The difference has to be brought down to the opposite side below the total. ‘Balance b/d’ is to be entered in the particulars column against the difference brought down and in the date column, the first day of the next accounting period is entered.

6. If the total on the debit side of an account is higher, the balancing figure is debit balance and if the credit side of an account has higher total, the balancing figure is credit balance. If the two sides are equal, that account will show nil balance.

IV. Exercises

Question 1.
Journalise the following transactions and post them to ledger.
2016 Jan.1 Started business with cash – 10,000
5 Paid into bank – 5,000
7 Purchased goods from Ram for cash – 1,000
Answer:
Journal of Mr. X
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 1
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 2
Bank Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 3

Question 2.
Give journal entries for the following transactions and post them to ledger.
2015, March 1 Goods sold to Somu on credit – 5,000
7 Furniture purchased for cash – 300
15 Interest received – 1,800
Answer:
Journal of Mr.Y
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 4
Ledger Account
Samu Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 5
Furniture Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 6

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 3.
Pass journal entries for the following transactions and post them to ledger.
2017 Aug 1 Dharma started business with cash – 70,000
6 Cash received from Ganesan – 10,000
10 Rent paid – 3000
20 Received commission from Anand – 5000
Answer:
Journal of Mr. Dharma
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 7
Dharma Capital Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 8
Rent Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 9

Question 4.
Record the following transactions in the journal of Banu and post them to the ledger.
2018, Sep 1 Commenced business with cash – 90,000
5 Rent received – 4,000
12 Purchased 6 tables from Gobu & Co. for cash – 6,000
Answer:
Journal of Mr. Banu
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 10
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 11

Question 5.
The following balances appeared in the books of Vinoth on Jan 1, 2018.
Assets: Cash Rs 40,000; Stock Rs 50,000; Amount due from Ram Rs 20,000
Machinery Rs 40,000 Liabilities: Amount due to Vijay Rs 10,000
Pass the opening journal entry and post them to Vinoth’s Capital account,
Answer:
Opening Entry
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 12

Question 6.
Prepare Furniture A/c from the following transactions
2016, Jan 1 Furniture in hand – 2,000
1 Purchased furniture for cash – 4,000
30 Sold furniture – 400
Answer:
Furniture Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 13

Question 7.
The following balances appeared in the books of Kumaran on April 1, 2017.
Assets: Cash Rs 1,00,000; Stock Rs 40,000; Amount due from Rohit Rs 10,000;
Furniture Rs 10,000;
Liabilities: Amount due to Anusha Rs 40,000;
Kumaran’s capital Rs 1,20,000
Find the capital and show the ledger posting for the above opening balances.
Answer:
Opening Entry
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 14
Stock Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 15
Furniture Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 16
Kumaran Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 17

Question 8.
Give journal entries and post them to cash account.
2016, June 1 Commenced business with cash – 1,10,000
10 Introduced additional capital – 50,000
28 Withdrawn for personal use – 20,000
Answer:
Journal Entry
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 18

Question 9.
Give journal entries from the following transactions of Mohit, dealing in Textiles and post them to ledger.
2014 Aug 1 Commenced business with cash – 1,10,000
7 Opened bank account with SBI – 50,000
3 Purchased furniture for cash – 20,000
Answer:
Journal of Mohit
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 19
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 20
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 21

Question 10.
Give journal entries for the following transactions and post them to ledger.
2016, sep 1 Commenced business with cash – 80,000
7 Bought goods for cash from Roopan – 10,000
10 Purchased goods from Hema on credit – 42,000
22 Goods returned to Hema – 2,000
23 Cash paid to Hema – 10,000
Answer:
Journal of Entry Mr. Y
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 22
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 23
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 24

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 11.
Give Journal entries for the following transactions and post them to Cash A/c and
Sales A/c.
2017, Aug 10 Sold goods and cheque received but not deposited – 30,000
14 Sold goods on credit to Gopi – 12,000
20 Received cash from Gopi – 12,000
Answer:
Journal of Entry Mr. Y
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 25
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 26

Question 12.
Journalise the transactions given below and post them to ledger.
2017 Oct. 18 Paid trade expenses – 1,000
25 Bought postage stamps – 100
30 Commission received – 6,000
30 Rent paid – 4,000
Answer:
Journal of Entries
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 27
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 28
Commission Received Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 29

Question 13.
Journalise the following transactions and prepare ledger accounts.
2015, Feb 1 Sold goods for cash – 5,000
2 Purchased goods from Kumar on credit – 4,000
5 Sold goods to Prabu on credit – 8,000
12 Received cash from Prabu – 1,200
20 Paid to Kumar – 2,000
25 Paid salary – 3,000
Answer:
Journal Entry
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 30
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 31
Prabhu Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 32
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 33

Question 14.
Enter the following transactions in the books of Ganesan and post them into ledger.
2017, Oct 1 Started business with cash – 25,000
5 Deposited into bank – 12,500
10 Purchased furniture and payment by cheque – 2,000
15 Goods purchased for cash – 5,000
19 Sold goods to Vasu on credit – 4,000
22 Goods worth Rs 500 taken for personal use
Answer:
Journal of Ganesan
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 34
Ledger Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 35
Bank Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 36
Vasu Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 37

Question 15.
Journalise the following transactions in the books of Arun and post them to ledger accounts
accounts.
2017, Dec 1 Arun started his business with cash – 10,000
3 Bought goods for cash – 1,500
8 Sold goods to Krishna on credit – 4,000
14 Purchased goods from Govind on credit – 2,000
25 Received cash from Krishna – 3,000
28 Cash paid to Govind – 1,000
Answer:
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 38
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 39
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 40
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 41

Question 16.
Journalise the following transactions and post them to ledger in the books of Raja.
2018, Mar 1 Sold goods to Senthil for cash – 9,000
5 Sold goods to Murali on credit – ,500
9 Cash sales – 6,000
18 Bought goods from Mani on credit – 3,200
23 Received Rs 4,000 from Murali in full settlement of his account
Answer:
Journal of Raja
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 42
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 43
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 44

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 17.
Journalise the following transactions and post them to the ledger.
2017, July 1 Cash in hand – 50,000
5 Goods purchased by cash – 30,000
7 Insurance paid – 2,500
10 Machinery purchased for cash – 9,000
15 Interest received – 2,000
18 Goods sold for cash – 7,000
Answer:
Journal of Entry of Mr. Y
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 45
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 46
Machinary Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 47

Question 18.
Journalise the following transactions in the books of Vasu and post them to ledger accounts.
2017, Nov 1 Cash in hand Rs 1,00,000; Cash at bank: Rs 30,000
2 Vasu sold goods to Jothi for Rs 25,000 against a cheque and deposited the same in the bank
4 Received as commission Rs 5,000
8 Bank paid Rs 15,000 directly for insurance premium of Vasu.
15 Cash deposited into bank Rs 30,000
20 Cash withdrawn from bank for personal use Rs 45,000.
Answer:
Journal of Mr. Vasu
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 48
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 49
Bank Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 50
Commission Received Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 51

Question 19.
Prepare Anand’s account from the following details.
2017, July 1 Credit balance of Anand’s A/c – 4,000
15 Amount paid to Anand – 2,000
18 Goods purchased from Anand on credit – 8,000
20 Paid to Anand – 3,960
Discount allowed by him – 40
25 Goods purchased from Anand – 5,000
Answer:
Ledger Account
Dr. Anand’s Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 52

Question 20.
Prepare a Sales account from the following transactions.
2018, Jan 1 Sold goods to Sam – 4,000
4 Sold goods to Suresh – 2,500
11 Sold goods to Joy – 8,000
17 Sold goods to Rajan – 3,000
Answer:
Ledger Account
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 53

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 21.
Show the direct ledger postings for the following transactions:
2017, June 1 Raja commenced business with cash Rs 50,000,
6 Sold goods for cash Rs 8,000
8 Sold goods to Devi on credit Rs 9,000
15 Goods purchased for cash Rs 4,000
20 Goods purchased from Shanthi on credit Rs 5,000
Answer:
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 54
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 55
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 56

Question 22.
Show the direct ledger postings for the following transactions:
2017, July 1 Shankar commenced business with a cash of Rs 1,00,000
5 Sold goods for cash Rs 10,000
9 Wages paid Rs 6,000
19 Salaries paid Rs 8,000
20 Advertisement expenses paid Rs 4,000
Answer:
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 57
Shankar Capital Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 58
wages Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 59

11th Accountancy Guide Ledger Additional Important Questions and Answers

I. Choose the correct answer.

Question 1.
Ledger is a book of:
(a) original entry
(b) final entry
(c) ail cash transactions
(d) contra entry
Answer:
(b) final entry

Question 2.
Personal and real accounts are:
(a) closed
(b) Balanced
(c) closed and transferred
(d) opening
Answer:
(b) Balanced

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 3.
The column of ledger which links the entry with journal is
(a) L.F column
(b) J.F column
(c) Date column
(d) Particulars column
Answer:
(b) J.F column

Question 4.
Posting on the credit side of an account is written as
(a) To
(b) By
(c) Being
(d) Both (a) and (b)
Answer:
(b) By

Question 5.
Posting on the Debit side of an account is written as
(a) To
(b) By
(c) Being
(d) Both (a) and (b)
Answer:
(a) To

Question 6.
Nominal account having credit balance represents
(a) income / gain
(b) expenses / losses
(c) assets
(d) liabilities
Answer:
(a) income / gain

Question 7.
Nominal account having debit balance represents
(a) income / gain
(b) expenses / losses
(c) liability
(d) assets
Answer:
(b) expenses / losses

Question 8.
Real accounts always show
(a) debit balances
(b) credit balances
(c) nill balance
(d) Both (a) and (b)
Answer:
(a) debit balances

Question 9.
Account having credit balance is closed by writing
(a) To Balance b/d
(b) By Balance c/d
(c) To Balance c/d
(d) By Balance b/d
Answer:
(c) To Balance c/d

Question 10.
When the total of debits and credits are equal, it represents
(a) debit balance
(b) credit balance
(c) nil balance
(d) opening balance
Answer:
(c) nil balance

Question 11.
The balances of personal and real accounts are shown in the
(a) profit and loss account
(b) balance sheet
(c) trading account
(d) both (a) and (b)
Answer:
(b) balance sheet

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 12.
If the total of the credit side of an account exceeds the total of its debit side, it means
(a) Credit balance
(b) Debit balance
(c) Nil balance
(d) Debit and credit balance
Answer:
(a) Credit balance

Question 13.
The closing balance is the next year’s
(a) debit balance
(b) credit balance
(c) nil balance
(d) opening balance
Answer:
(d) opening balance

Question 14.
The ledger account is prepared in format.
(a) T
(b) D
(c) C
(d) U
Answer:
(a) T

Question 15.
The process of recording business transactions in a chronological order is called ……………
(a) Recording
(b) Posting
(c) Journalizing
(d) Classifying
Answer:
(c) Journalizing

Question 16.
Which one of the following is known as the king of all books of accounts?
(a) Recording
(b) Posting
(c) Journalizing
(d) Classifying
Answer:
(c) Journalizing

Question 17.
A decrease in the provision for doubtful debts would result in
(a) Increase in liability
(b) Decrease in liability
(c) Decrease in the net profit
(d) Increase in the net profit
Answer:
(d) Increase in the net profit

Question 18.
The discount which is calculated on the list price of the goods is called .
(a) Cash discount
(b) Rebate
(c) Trade discount
(d) Discount
Answer:
(c) Trade discount

Question 19.
Merchandise stolen by someone should be debited to …………..
(a) Sales account
(b) Purchases account
(c) Loss by theft account
(d) None of the above
Answer:
(c) Loss by theft account

Question 20.
The owner of the business takes Rs.100 cash and goods costing Rs.200 for his family. The proper journal entry for this transaction is called ……………..
(a) drawing > debit; Cash > Credit; Purchases > Credit
(b) Drawing > debit; Cash > Credit; merchandise > credit
(c) Drawing > debit; Cash > credit; Sales > credit
(d) cash > debit; Purchases > debit; drawings > credit
Answer:
(a) drawing > debit; Cash > Credit; Purchases > Credit

II. Very Short Answer Type Questions

Question 1.
What is Nil balance?
Answer:
If the two sides are equal, that account will show nil balance.

Question 2.
What are the steps involved in posting the opening entry?
Answer:
Step 1:
The items debited in the opening entry are entered on the debit side of respective accounts. The words ‘To Balance b/d’ are written in the particulars column with respective amounts in the amount column, date being the first day of the accounting period.

Step 2:
The items credited in the opening entry are entered on the credit side of respective accounts. The words ‘By Balance b/d’ are written in the particulars column with respective amounts in the amount column, date being the first day of the accounting period.

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 3.
Indicate the nature of normal balance in the following accounts.
Answer:
a. Cash – Debit balance
b. Creditors – Credit balance
c. Sales – Credit balance
d. Furniture – Debit balance
e. Commission received – Credit balance
f. Debtors – Debit balance
g. Purchases – Debit balance
h. Capital – Credit balance
i. Discount earned – Credit balance
j. Computer – Debit balance

Question 4.
Define ledger.
Answer:
According to L.C. Cropper, ‘the book which contains a classified and permanent record of all the transactions of a business is called the Ledger’.

Question 5.
What is compound journal entry?
Answer:
When a journal entry has more than one debit or more than one credit or both, it is called a compound entry.

III. Additional Sums

Question 1.
Prepare cash account A/c from the following transactions.
2018 Jan. 1 Commenced business with cash Rs 62,000
2 Good purchased for cash Rs 12,000
10 Cash sales Rs 10,000
12 Wages paid Rs 4,000
25 Furniture purchased for cash Rs 6,000
Answer:
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 60

Question 2.
Prepare a sales A/c from the following transaction.
2018 Feb. 1 Cash sales – 5,000
4 Sold goods to Suresh – 4,000
8 Sold goods to Mohan – 8,000
12 Sold goods for cash – 3,000
Answer:
Ledger Account
Sales Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 61

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 3.
Prepare Rangasamy A/c for the following transaction.
2017 Aug. 17 Goods purchased from Rangasamy Rs. 20,000
19 Goods returned to Rangasamy Rs. 5,000
31 Settles Rangasamy’s account
Answer:
Ledger Account
Rangasamy Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 62

Question 4.
Prepare Chitra account from the following transaction.
2018 March. 18 Sold goods to Chitra Rs. 1,26,000
24 Chitra returned goods Rs. 6,000
28 Chitra settled her account
Answer:
Chitra Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 63

Question 5.
Journalise the following transaction and post them to ledger in the book of Mr. Raja.
2018, Jan. 1 Started business with cash Rs 3,00,00
2 Opening bank account by deposition Rs 2,00,000
5 Purchased goods for cash Rs 10,000
15 Cash sales Rs 5,000
22 Purchased goods from X and Co. for Rs 15,000 and the payment is made through net banking
25 Sold goods for Y and Co. for Rs 30,000 and the payment is received thought NEET
Answer:
Journal of Mr. Raja
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 64
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 65
Raja Capital Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 66
Purchases Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 67

Question 6.
Post the following Journal into Ledger of Thiru. Gowri Shankar.
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 68
Answer:
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 69
Sayeed Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 70
David Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 71

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Question 7.
Show the sivect ledger positions for the following transaction.
2018, May. 1 Commenced business with cash Rs 1,50,000
2 Sold goods for cash Rs 50,000
5 Purchases goods for cash Rs 25,000
25 Salaries paid Rs 15,000
30 Wages paid Rs 10,000
Answer:
Ledger Account
Cash Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 72
Capital Account
Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger 73

Samacheer Kalvi 11th Accountancy Guide Chapter 4 Ledger

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 14 Classes and Objects Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 14 Classes and Objects

11th Computer Science Guide Classes and Objects Text Book Questions and Answers

Book Evaluation

Part I

Choose The Correct Answer
Question 1.
The variables declared inside the class are known as data members and the functions are known as
a) data functions
b) inline functions
c) member functions
d) attributes
Answer:
c) member functions

Question 2.
Which of the following statements about member functions are True or False?
i) A member function can call another member function directly with using the dot operator.
ii) Member function can access the private data of the class.
a) i-True, ii-True
b) i-False, ii-True
c) i-True, ii-False
d) i-False, ii-False
Answer:
b) i-False, ii-True

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 3.
A member function can call another member function directly, without using the dot operator called as
a) sub function
b) sub member
c) nesting of member function
d) sibling of member function
Answer:
c) nesting of member function

Question 4.
The member function defined within the class behave like
a) inline functions
b) Non inline function
c) Outline function
d) Data function
Answer:
a) inline functions

Question 5.
Which of the following access specifier protects data from inadvertent modifications?
a) Private
b) Protected
c) Public
d) Global
Answer:
a) Private

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 6.
class x
{
inty;
public:
x(int z)
{
y=z;
}
} x1[4];
intmain( )
{
x x2(10);
return 0;
}
How many objects are created for the above program?
a) 10
b) 14
c) 5
d) 2
Answer:
c) 5

Question 7.
State whether the following statements about the constructor are True or False.
i) constructors should be declared in the private section.
ii) constructors are invoked automatically when the objects are created.
a) True, True
b) True, False
c) False, True
d) False, False
Answer:
c) False, True

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 8.
Which of the following constructor is executed for the following prototype ?
add display (add &); // add is a class name
a) Default constructor
b) Parameterized constructor
c) Copy constructor
d) Non Parameterized constructor
Answer:
c) Copy constructor

Question 9.
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero- argument constructor?
a) Compile-time error
b) Domain error
c) Runtime error
d) Runtime exception
Answer:
a) Compile-time error

Question 10.
Which of the following create a temporary instance?
a) Implicit call to the constructor
b) Explicit call to the constructor
c) Implicit call to the destructor
d) Explicit call to the destructor
Answer:
b) Explicit call to the constructor

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Part – II

Very Short Answers

Question 1.
What are called members?
Answer:
The class comprises members. Members are classified as Data Members and Member functions. Data members are the data variables that represent the features or properties of a class. Member functions are the functions that perform specific tasks in a class.

Question 2.
Differentiate structure and class though both are user-defined data types.
Answer:
The only difference between structure and class is the members of the structure are by default public whereas it is private in class.

Question 3.
What is the difference between the class and object in terms of oop?
Answer:
Object:

  • Object is an instance of a class.
  • Object is a real-world entity such as pen, laptop, mobile, chair, etc.
  • Object allocates memory when it is created.

Class:

  • Class is a blueprint or template from which objects are created.
  • Class is a group of similar objects.
  • Class doesn’t allocate memory when it is created.

Question 4.
Why it is considered a good practice to define a constructor though a compiler can automatically generate a constructor?
Answer:
A user-defined constructor is the best method of initialise array of objects and normal objects.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 5.
Write down the importance of the destructor.
Answer:
The purpose of the destructor is to free the resources that the object may have acquired during its lifetime. A destructor function removes the memory of an object which was allocated by the constructor at the time of creating an object.

Part – III

Short Answers

Question 1.
Rewrite the following program after removing the syntax errors if any and underline the errors:
#include<iostream>
#include<stdio.h>
classmystud
{ intstudid =1001;
char name[20];
public
mystud( )
{ }
void register ( ) {cin>>stdid;gets(name);
}
void display ( )
{ cout<<studid<<“: “<<name<<endl;}
}
int main( )
{ mystud MS;
register.MS( );
MS.display( );
}
Answer:
MODIFIED PROGRAM:
#include<iostream>
#include<stdio.h>
class mystud
{
int studid;
char name[20];
public:
mystud( )
{
studid=1001;
}
void register ( )
{
cin>>stdid;
gets(name);
}
void display ( )
{
cout<<studid<<“: “<<name<<endl;
}
};
int main( )
{
mystud MS;
MS.reqister( );
MS.display( );
}

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 2.
Write with an example of how will you dynamically initialize objects?
Answer:
Dynamic initialization of Objects:
When the initial values are provided during runtime then it is called dynamic initialization.
Program to illustrate dynamic initialization
#include
using namespace std;
class X
{
int n;
float avg;
public:
X(int p,float q)
{
n=p;
avg=q;
}
void disp( )
{
cout<<“\n Roll numbe:-” <<n;
cout<<“\nAverage :-“<<avg;
}
};
int main( )
{
int a ; float b;
cout<<“\nEnter the Roll Number”;
cin>>a; .
cout<<“\nEnter the Average”;
cin>>b;
X x(a,b); // dynamic initialization
x.disp( );
return 0;
}
Output
Enter the Roll Number 1201
Enter the Average 98.6
Roll number:- 1201
Average :- 98.6

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 3.
What are advantages of declaring constructors and destructor under public access ability?
Answer:

When constructor and destructor are declared under public:

  1. we can initialize the object while declaring it.
  2. we can explicitly call the constructor.
  3. we can overload constructors and therefore use multiple constructors to initialize objects automatically.
  4. we can destroy the objects at the end of class scope automatically (free unused memory).

However, some C++ compiler and Dev C++ do not allow to declare constructor and destructor under private section. So it is better to declare constructor and destructor under public section only.

Question 4.
Given the following C++ code, answer the questions (i) & (ii).
Answer:
class TestMeOut
{
public:
~TestMeOut( ) //Function 1
{
cout<<“Leaving the examination hall”<<endl;
}
TestMeOut( ) //Function 2
{
cout<<“Appearing for examination'<<endl;
}
void MyWork( ) //Function 3
{
cout<<“Attempting Questions//<<endl;
}
};
i) In Object-Oriented Programming, what is Function 1 referred to as and when does it get invoked/called?
Function 1 is called a destructor. It will be automatically invoked when the object goes out of scope (ie. at the end of a program).

ii) In Object-Oriented Programming, what is Function 2 referred to as, and when does it get invoked/called?
Function2 is called a constructor. It will be automatically invoked when an object comes into scope.(ie. at the time of object creation).

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 5.
Write the output of the following C++ program code:
Answer:
#include<iostream>
using namespace std;
class Calci
{
char Grade; .
int Bonus;
public:
Calci( )
{
Grade=’E’;
Bonus=0;
}//ascii value of A=65
void Down(int G)
{
Grade-=G;
}
void Up(int G)
{
Grade+=G;
Bonus++;
}
void Show( )
{
cout<<Grade<<“#”<<Bonus<<endl;
}
};
int main( )
{
Calci c;
c.Down(3);
c.Show( );
c.Up(7);
c.Show( );
c.Down(2);
c.Show( );
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 1

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Part – IV

Explain In Detail

Question 1.
Explain nested class with example.
Answer:
When one class becomes a member of another class then it is called Nested class and the relationship is called containership. When a class is declared within another class, the inner class is called a Nested class (i.e. the inner class) and the outer class is known as the Enclosing class. The nested class can be defined in private as well as in the public section of the Enclosing class.

Classes can be nested in two ways:

  1. By defining a class within another class
  2. By declaring an object of a class as a member to another class
  3. By defining a class within another class

C++ program to illustrate the nested class
#include<iostream>
using namespace std;
class enclose
{
private:
int x;
class nest
{
private :
int y;
public:
int z;
void prn( )
{
y=3;z=2;
cout<<“\n The product of”
< <y< <‘*'< <z<<“= “< <y*z< <“\n”;
}
}; //inner class definition over
nest m1;
public:
nest n2;
void square( )
{
n2.prn( ); //inner class member function is called by its object
x=2;
n2.z=4;
cout<<“\n The product of” <<n2.z<<‘*'<<n2.z<<“=”n2.z*n2.z<<“/n”;
cout<<“\n The product of” <<x<<‘*'<<x<<“= “<<x*x;
}
}; //outer class definition over
int main( )
{
enclose e;
e.square( ); //outer class member function is called
}
Output
The product of 3*2=6
The product of 4*4=16
The product of 2*2=4

In the above program the inner class nest is defined inside the outer class enclose, nest is accessed by enclose by creating an object of nest

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 2.
Mention the differences between constructor and destructor.
Answer:

CONSTRUCTOR

DESTRUCTOR

The name of the constructor must be same as that of the class. The destructor has the same name as that of the class prefixed by the tilde character
A constructor can have parameter list. The destructor cannot have arguments.
The constructor function can be overloaded. Destructors cannot be overloaded i.e., there can be only one destructor in a class.
Constructor cannot be inherited but a derived class can call the base class constructor. Destructor cannot be inherited.
The constructor is executed automatically when the object is created. The destructor is executed automatically when the control reaches the end of class.
Allocated memory space for the object. Destroy the object.

Question 3.
Define a class RESORT with the following description in C++ :
Answer:
Private members:
Rno // Data member to storeroom number
Name //Data member to store user name
Charges //Data member to store per day charge
Days //Data member to store the number of days
Compute ( ) // A function to calculate total amount as Days * Charges and if the
//total amount exceeds 11000 then total amount is 1.02 * Days *Charges

Public member:
getinfo( ) // Function to Read the information like name , room no, charges and days
dispinfo ( ) // Function to display all entered details and total amount calculated
//using COMPUTE function
PROGRAM
using namespace std;
#include<iostream>
class RESORT
{
private:
int Rno,Days,Charges;
char Rname[20];
int compute( )
{
if (Days * Charges >11000)
return (Days * Charges * 1.02);
else
return(Days * Charges);
}
public:
getinfo( )
{
cout<<“\nEnter customer name : “;
cin>>Rname;
cout<<‘nEnter charges per day : “;
cin>>Charges;
cout< <‘nEnter Number of days : “;
cin>>Days;
cout<<‘n Enter Room Number : “;
cin>>Rno;
}
dispinfo( )
{
cout<<‘nRoom Number :
“<<Rno;
cout<<‘nCustomer name :
“<<Rname;
cout<<‘nCharges per day :
“<<Charges;
cout<<‘nNumber of days :
“<<Days;
cout<<‘nTotal Amount :
“<<compute( );
}
int main( )
{
RESORT Obj;
Obj,getinfo( );
Obj.dispinfo( );
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 2

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 4.
WrIte the output of the following:
Answer:
#include<iostream>
#indude<stdio.h>
using namespace std;
class sub
{
int day, subno;
public :
sub(int,int); // prototype
void printsub( )
{
cout<<” subject number: “<<subno;
cout<<” Days : ” <<day;
}
};
sub::sub(int d=150,int sn=12)
{
cout<<endl<<“Constructing the object
“<<endl;
day=d;
sub no=sn;
}
class stud ‘
{
int rno;
float marks; public:
stud( )
{
cout<< “Constructing the object of
students “<<endl;
rno=0;
marks=0.0;
}
void getval( )
{
cout<<“Enter the roll number and the marks secured”; cin>>rno>>marks;
}
void printdet( )
{
cout<<“Roll no : “<<rno<<“Marks : “<<marks<<endl; .
}
};
class admission
{
sub obj;
stud objone;
float fees; ,
public :
admission ( )
{
cout<< “Constructing the object of admission “<<endl;
fees=0.0;
}
void printdet( )
{
objone.printdet( );
obj.printsub();
cout<<“fees : “<<fees<<endl;
}
};
int main( )
{
system (“cls”);
admission adm;
cout<<endl<< ?’Back in main ()”;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 3

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 5.
Write the output of the following.
Answer:
#indude<iostream>
#include<stdio,h>
using namespace std;
class P
{
public:
P( )
{
cout<< “\nConstructor of class P }
~P( )
{
cout< < “\nDestructor of class P
}
};
class Q
{
public:
Q( )
{
cout< <“\nConstructor of class Q “;}
~ Q( )
{
cout<< “\nDestructor of class Q
}
};
class R
{
P obj1, obj2;
Q obj3;
public:
R( )
{
cout<< “\nConstructor of class R “;}
~R( )
{
cout<< “\nDestructor of class R
}
};
int main ( )
{
R oR; :
Q oq;
Pop;
return 0;
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 4

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

11th Computer Science Guide Classes and Objects Additional Questions and Answers

Choose The Correct Answer (1 Mark)

Question 1.
The most important feature of C++ is ………………..
(a) object
(b) class
(c) public
(d) All the above
Answer:
(b) class

Question 2.
How many features are commonly present in OOP languages?
a) 3
b) 2
c) 4
d) 5
Answer:
c) 4

Question 3.
Calling a member function of an object is also known as ……………….. to object.
(a) call function
(b) call by value
(c) call by reference
(d) sending message
Answer:
(d) sending message

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 4.
……………… is a way to bind the data and its associated functions together,
a) Class
b) Array
c) Structure
d) All the above
Answer:
a) Class

Question 5.
When one class become a member of another class, the relationship is called ………………..
(a) containership
(b) partnership
(c) friendship
(d) all the above
Answer:
(a) containership

Question 6.
The body of the class is defined inside the ………………. brackets.
a) Angle < >
b) Square [ ]
c) Curly { }
d) None of these
Answer:
c) Curly { }

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 7.
……………….. can be defined either in private or in the public section of a class.
(a) Object
(b) Data type
(c) Memory
(d) constructor
Answer:
(d) constructor

Question 8.
The members of the structure are by default ………………..
a) Private
b) Public
c) Protected
d) None of these
Answer:
b) Public

Question 9.
There are ……………….. ways to create an object using the parameterized constructor.
(a) 3
(b) 2
(c) 1
(d) 4
Answer:
(c) 1

Question 10.
The class body contains ………………….
a) Data members
b) Member functions
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 11.
The class body has………………… access specifiers.
a) Three
b) Four
c) Two
d) Five
Answer:
a) Three

Question 12.
The class body has…………….. access specifiers.
a) Private
b) Public
c) Protected
d) All the above
Answer:
d) All the above

Question 13.
…………………. is a visibility label.
a) Private
b) Public
c) Protected
d) All the above
Answer:
d) All the above

Question 14.
……………….. allows preventing the functions of a program to access directly the internal representation of a class type.
a) Data Hiding
b) Data Capturing
c) Data Processing
d) None of these
Answer:
a) Data Hiding

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 15.
The access restriction to the class members is specified by ……………. section within the class
body.
a) Private
b) Public
c) Protected
d) All the above
Answer:
d) All the above

Question 16.
A …………………. member is accessible from where outside the class but within a program.
a) Private
b) Public
c) Protected
d) All the above
Answer:
b) Public

Question 17.
We can set and get the value of public data members using ………………… function.
a) Member
b) Nonmember
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 18.
A …………….. member cannot be accessed from outside the class.
a) Private
b) Public
c) Protected
d) All the above
Answer:
a) Private

Question 19.
Only the class member functions can access ……………… members.
a) Private
b) Public
c) Protected
d) All the above
Answer:
a) Private

Question 20.
……………….. members can be accessed in child classes.
a) Private
b) Public
c) Protected
d) All the above
Answer:
c) Protected

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 21.
If all members of the class are defined as …………….. then the class become frozen.
a) Private
b) Public
c) Protected
d) All the above
Answer:
a) Private

Question 22.
If all members of the class are defined as ………………….. then the object of the class can not access anything from the class,
a) Private
b) Public
c) Protected
d) All the above
Answer:
a) Private

Question 23.
………………. are the data variables that represent the features or properties of a class.
a) Data members
b) Member functions
c) Both A and B
d) None of these
Answer:
a) Data members

Question 24.
………………… are the functions that perform specific tasks in a class.
a) Data members
b) Member functions
c) Both A and B
d) None of these
Answer:
b) Member functions

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 25.
Member functions are called as …………………..
a) Methods
b) Attributes
c) Properties
d) None of these
Answer:
a) Methods

Question 26.
Data members are also called as ……………….
a) Methods
b) Attributes
c) Properties
d) None of these
Answer:
b) Attributes

Question 27.
Classes contain a special member function called as ……………………
a) Constructors
b) Destructors
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 28.
The member functions of a class can be defined in ……………….. ways.
a) Two
b) Three
c) Four
d) Five
Answer:
a) Two

Question 29.
The member functions of a class can be defined in ………………. way.
a) Inside the class definition
b) Outside the class definition
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 30.
When a member function is defined Inside a class, it behaves like ………………. functions.
a) Inline
b) General
c) Local
d) None of these
Answer:
a) Inline

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 31.
If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at ………………….
a) Run Time
b) Compile time
c) Both A and B
d) None of these
Answer:
b) Compile time

Question 32.
When Member function defined outside the class, and then it is be called as ………………….
member function.
a) Outline
b) Non-inline
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 33.
When Member function defined outside the class using …………….. operator.
a) Scope resolution
b) Membership
c) Reference
d) Conditional
Answer:
a) Scope resolution

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 34.
The class variables are called ………………….
a) Object
b) Attributes
c) Procedures
d) None of these
Answer:
a) Object

Question 35.
Objects are also called as …………………. of class.
a) Instant
b) Instance
c) Attributes
d) None of these
Answer:
b) Instance

Question 36.
Objects can be created in ………………… methods.
a) Three
b) Four
c) Two
d) Five
Answer:
c) Two

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 37.
Objects can be created as ……………….
a) Global object
b) Local object
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 38.
…………….. objects can be used by any function in the program.
a) Global object
b) Local object
c) Either A or B
d) None of these
Answer:
a) Global object

Question 39.
If an object is declared outside all the function bodies or by placing their names immediately after the closing brace of the class declaration then it is called as ……………….
a) Global object
b) Local object
c) Either A or B
d) None of these
Answer:
a) Global object

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 40.
If an object is declared within a function then it is called ……………….
a) Global object
b) Local object
c) Either A or B
d) None of these
Answer:
b) Local object

Question 41.
……………….. object can not be accessed from outside the function.
a) Global
b) Local
c) Either A or B
d) None of these
Answer:
b) Local

Question 42.
No separate space is allocated for …………………. when the objects are created.
a) Member functions
b) Data members
c) Both A and B
d) None of these
Answer:
a) Member functions

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 43.
Memory space required for the ……………….
a) Member functions
b) Data members
c) Both A and B
d) None of these
Answer:
b) Data members

Question 44.
The members of a class are referenced (accessed) by using the object of the class followed by the ………………. operator.
a) Scope resolution
b) Conditional
c) Dot (membership)
d) None of these
Answer:
c) Dot (membership)

Question 45.
Calling a member function of an object is also known as ……………….
a) Sending a message to object
b) Communication with the object
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 46.
An array which contains the class type of element is called …………………
a) Array of objects
b) Structure Objects
c) Block of objects
d) None of these
Answer:
a) Array of objects

Question 47.
The ………………… of the outline member function given in a class specification, instructs the compiler about its visibility mode.
a) Name
b) Prototype
C) Data type
d) None of these
Answer:
b) Prototype

Question 48.
A member function can call another member function of the same class directly without using the dot operator is called ………………………
a) Nesting of the member function
b) Invariant Members
c) Variant Members
d) None of these
Answer:
a) Nesting of the member function

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 49.
A member function can call another member function of the same class for that you do not
need a(n) …………………..
a) Member function
b) Data Member
c) Object
d) None of these
Answer:
c) Object

Question 50.
A member function can access ………………. functions.
a) Public
b) Private
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 51.
…………………. operator will reveal the hidden file scope(global) variable.
a) Membership
b) Conditional
c) Scope resolution
d) All the above
Answer:
c) Scope resolution

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 52.
When an object is passed by ……………… the function creates its own copy of the object and works on it.
a) Value
b) Reference
c) Either A or B
d) None of these
Answer:
a) Value

Question 53.
When an object is passed by …………….. changes made to the object inside the function do not affect the original object.
a) Value
b) Reference
c) Either A or B
d) None of these
Answer:
a) Value

Question 54.
When an object is passed by ……………….. its memory address is passed to the function so the called function works directly on the original object used in the function call.
a) Value
b) Reference
c) Either A or B
d) None of these
Answer:
b) Reference

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 55.
When an object is passed by ………………………. any changes made to the object inside the function definition are reflected in the original object.
a) Value
b) Reference
c) Either A or B
d) None of these
Answer:
b) Reference

Question 56.
Member Functions can ………………….
a) Receive object as an argument
b) Return an object
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 57.
When one class become a member of another class then it is called ……………. class.
a) Nested
b) Inline
c) External
d) Global
Answer:
a) Nested

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 58.
When one class becomes a member of another class then the relationship is called ………………….
a) Containership
b) Nesting
c) Parent-Child
d) None of these
Answer:
a) Containership

Question 59.
Classes can be nested in ……………….. ways.
a) Three
b) Two
c) Four
d) Five
Answer:
b) Two
Question 60.
Classes can be nested in ………………..way.
a) By defining a class within another class
b) By declaring an object of a class as a member to another class
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 61.
When a class is declared within another class, the inner class is called a Nested class (ie the inner class) and the outer class is known as …………………… class.
a) Enclosing
b) Abstract
c) Transit
d) None of these
Answer:
a) Enclosing

Question 62.
The nested class can be defined in ………………….. section of the Enclosing class.
a) Private
b) Public
c) Either Private or Public
d) None of these
Answer:
c) Either Private or Public

Question 63.
Whenever an object of a class is declared as a member of another class it is known as a _____ class.
a) Abstract
b) Container
c) Literal
d) None of these
Answer:
b) Container

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 64.
Instantiating object is done using ……………….
a) Constructor
b) Destructor
c) Data abstraction
d) Data hiding
Answer:
a) Constructor

Question 65.
A(n) ………………..in C++ can be initialized during the time of their declaration.
a) Array
b) Structure
c) Array or Structure
d) None of these
Answer:
c) Array or Structure

Question 66.
Member function of a class can access all the members irrespective of their associated …………………..
a) Access specifier
b) Data type
c) Return type
d) Argument
Answer:
a) Access specifier

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 67.
When an instance of a class comes into scope, a special function called the ……………. gets executed.
a) Constructor
b) Destructor
c) Data abstraction
d) Data hiding
Answer:
a) Constructor

Question 68.
The constructor function name has the same name as the …………….. name.
a) Object
b) Class
c) Data member
d) None of these
Answer:
b) Class

Question 69.
The constructors return ………………
a) int
b) char
c) float
d) nothing
Answer:
d) nothing

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 70.
…………………. are not associated with any data type
a) Constructor
b) Data member
c) Data abstraction
d) Member functions
Answer:
a) Constructor

Question 71.
……………… can be defined either inside class definition or outside the Class definition.
a) Constructor
b) Destructor
c) Data abstraction
d) Member functions
Answer:
a) Constructor

Question 72.
A constructor can be defined in ……………… section of a class.
a) Private
b) Public
c) Either Private or Public
d) None of these
Answer:
c) Either Private or Public

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 73.
If a constructor is defined in ………………… section of a class, then only its object Can be created in any function.
a) Private
b) Public
c) Either Private or Public
d) None of these
Answer:
b) Public

Question 74.
The main function of the constructor is ……………………….
a) To allocate memory space to the object
b) To initialize the data member of the class object
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 75.
A constructor that accepts no parameter is called …………………… constructor.
a) Null
b) Default
c) Empty
d) None of these
Answer:
b) Default

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 76.
Identify the correct statement from following with respect to constructor.
a) If a class does not contain an explicit constructor (user defined constructor) the compiler automatically generate a default constructor implicitly as an inline public member.
b) In the absence of user defined constructor the compiler automatically provides the default constructor. It simply allocates memory for the object.
c) Parameterized constructor is achieved by passing parameters to the function.
d) All the above
Answer:
d) All the above

Question 77.
A constructor which can take arguments is called ……………….. constructor.
a) Parmeterized
b) Default
c) Empty
d) None of these
Answer:
a) Parmeterized

Question 78.
……………….. type of constructor helps to create objects with different initial values.
a) Parmeterized
b) Default
c) Empty
d) None of these
Answer:
a) Parmeterized

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 79.
Declaring a constructor with arguments hides the ……………………
a) Data members
b) Compiler generated constructor
c) Member functions
d) None of these
Answer:
b) Compiler generated constructor

Question 80.
………………… Constructor is used to creating an array of objects.
a) Default
b) Parameterized
b) Overloaded
d) None of these
Answer:
a) Default

Question 81.
There are ………………. ways to create an object using the parameterized constructor.
a) Three
b) Two
c) Four
d) Five
Answer:
b) Two

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 82.
……………… is a way to create an object using the parameterized constructor,
a) Implicit call
b) Explicit call
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 83.
In …………….. method, the parameterized constructor is invoked automatically
whenever an object is created.
a) Implicit call
b) Explicit call
c) Either A or B
d) None of these
Answer:
a) Implicit call

Question 84.
In the………………….. method, the name of the constructor is explicitly given to invoking the parameterized constructor.
a) Implicit call
b) Explicit call
c) Either A or B
d) None of these
Answer:
b) Explicit call

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 85.
………………… method is the most suitable method as it creates a temporary object
a) Implicit call
b) Explicit call
c) Either A or B
d) None of these
Answer:
b) Explicit call

Question 86.
The chance of data loss will not arise in ………………….. method.
a) Implicit call
b) Explicit call
c) Either A or B
d) None of these
Answer:
b) Explicit call

Question 87.
A ……………….. object lives in memory as long as it is being used in an expression.
a) Temporary
b) Nested
c) Inline
d) None of these
Answer:
a) Temporary

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 88.
A constructor having a reference to an already existing object of its own class is called ………………….. constructor.
a) Reference
b) Value
c) Copy
d) Move
Answer:
c) Copy

Question 89.
A copy constructor is called ……………..
a) When an object is passed as a parameter to any of the member functions
b) When a member function returns an object
c) When an object is passed by reference to an instance of its own class
d) All the above
Answer:
d) All the above

Question 90.
The constructors are executed in the …………………. of the object declared.
a) Order
b) Reverse order
c) Either A or B
d) None of these
Answer:
a) Order

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 91.
When the initial values are provided during runtime then it is called ………………….. initialization.
a) Static
b) Dynamic
c) Run time
d) None of these
Answer:
b) Dynamic

Question 92.
…………………. constructor can have parameter list.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
a) Constructor

Question 93.
No return type can be specified for ………………….
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 94.
The ……………….. function can be overloaded.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
a) Constructor

Question 95.
The compiler generates a ………………… in the absence of a user-defined.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
a) Constructor

Question 96.
Compiler generated constructor is ………………….. member function.
a) private
b) protected
c) public
d) None of these
Answer:
c) public

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 97.
The ………………. is executed automatically,
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 98.
The ……………. is executed automatically when the object is created.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
a) Constructor

Question 99.
When a class object goes out of scope, a special function called the ………………. gets executed.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
b) Destructor

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 100.
The destructor has the same name as the class tag but prefixed with a …………………
a) ~ (tilde)
b) #
c) @
d) None of these
Answer:
a) ~ (tilde)

Question 101.
A …………………… is a special member function that is called when the lifetime of an object ends.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
b) Destructor

Question 102.
The ………………… cannot have arguments,
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
b) Destructor

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 103.
There can be ……………… destructor in a class.
a) Two
b) Three
c) Only one
d) Four
Answer:
c) Only one

Question 104.
_____ cannot be inherited.
a) Constructor
b) Destructor
c) Both A and B
d) None of these
Answer:
c) Both A and B

Very Short Answer (2 Marks)

Question 1.
Define methods of a class and write its types.
Answer:
The class comprises members. Member functions are called methods. The member functions of a class can be defined in two ways.

  1. Inside the class definition
  2. Outside the class definition

Question 2.
Why classes are needed?
Answer:
Classes are needed to represent real-world entities that not only have data type properties but also have associated operations. It is used to create user-defined data types.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 3.
What is called as nesting of member functions?
Answer:
Only the public members of a class can be accessed by the object of that class, using the dot operator. However, a member function can call another member function of the same class directly without using the dot operator. This is called as nesting of member functions.

Question 4.
What are the visibility labels of a class body?
Answer:
The class body has three visibility labels viz., private, public, and protected. The Visibility labels are also called as access specifiers.

Question 5.
What is a parameterized constructor?
Answer:
A constructor which can take arguments is called a parameterized constructor. This type of constructor helps to create objects with different initial values. This is achieved by passing parameters to the function.

Question 6.
What happened if all the members of a class are defined as private?
Answer:
If all members of the class are defined as private, then the class becomes frozen.
The object of the class can not access anything from the class.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 7.
Write about objects.
Answer:
A class specification just defines the properties of a class. To make use of a class specified, the variables of that class type have to be declared. The class variables are called objects. Objects are also called an instance of the class.

For example:
student s;
In the above statement ‘s’ is an instance of the class student.

Question 8.
How many ways objects can be created for a class? Give its types.
Answer:
Objects can be created in two methods:

  1. Global object
  2. Local object

Question 9.
What do you mean by an array of objects?
Answer:
An array which contains the class type of element is called an array of objects. It is declared and defined in the same way as any other type of array.

Example:
class stock
{
int itemno;
float price; public:
}s[5];
Here s[5] is an array of objects.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 10.
What is a nested member function?
Answer:
A member function can cal! another member function of the same class directly without using the dot operator. This is called as nesting of member functions.

Question 11.
How many ways objects can be passed to function argument?
Answer:
Objects can also be passed in both ways

  • Pass By Value
  • Pass By Reference

Question 12.
What is a container class?
Answer:
Whenever an object of a class is declared as a member of another class it is known as a container class. In the container-ship, the object of one class is declared in another class.

Question 13.
What is the need for a constructor in a class?
Answer:
Instantiating object is done using constructor. An array or a structure in C++ can be initialized during the time of their declaration using constructor. The constructor function initializes the class object.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 14.
What are the functions of a constructor?
Answer:
The main functions of the constructor are:

  • To allocate memory space to the object and
  • To initialize the data member of the class object.

Question 15.
What is a default constructor?
Answer:
Default constructor:
A constructor that accepts no parameter is called the default constructor.
For example in the class Data program Data::Data( ) is the default constructor.
Using this constructor objects are created similar to the way the variables of other data types are created.

Example:
int num; //ordinary variable declaration
Data d1; // object declaration
If a class does not contain an explicit constructor the compiler automatically generates a default constructor implicitly as an inline public member.

Question 16.
What is the significance of default constructor?
Answer:
Default constructors are very useful to crate objects without having specific initial value. It is also used to create array of objects.

Question 17.
How many ways a constructor can be invoked?
Answer:
There are two ways to create an object using parameterized constructor:

  1. Implicit call
  2. Explicit call

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 18.
What is copy constructor?
Answer:
A constructor having a reference to an already existing object of its own class is called copy constructor.
In other words Copy Constructor is a type of constructor which is used to create a copy of an already existing object of a class type.

Question 19.
What is the order of constructor invocation?
Answer:
The constructors are executed in the order of the object declared. (If it is in same statement left to right)

For example:
Test t1;
Test t2; // the order of constructor execution is first for t1 and then for t2.
Consider the following example
Sample s1,s2,s3 ; //The order of construction is s1 then s2 and finally s3

Question 20.
What do you mean by dynamic initialization of Object?
Answer:
When the initial values are provided during runtime then it is called dynamic initialization.

Question 21.
Write a note on the destructor.
Answer:

  • When a class object goes out of scope, a special function called the destructor gets executed.
  • The destructor has the same name as the class tag but prefixed with a ~(tilde).
  • The destructor function also returns nothing and it does not associate with any data type

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 22.
What is the need for a destructor in a class?
Answer:
The purpose of the destructor is to free the resources that the object may have acquired during its lifetime. A destructor function removes the memory of an object which was allocated by the constructor at the time of creating an object

Question 23.
Define destructor.
Answer:
A destructor is a special member function that is called when the lifetime of an object ends and destroys the object constructed by the constructor. Normally it is declared under the public visibility of a class.

Short Answers (3 Marks)

Question 1.
Explain the local object with an example.
Answer:
If an object is declared within a function then it is called a local object.
It cannot be accessed from outside the function.
# include
# include
using namespace std
class add  //Global class
{
int a,b; public:
int sum; void
getdata()
{
a = 5; b = 10; sum
= a + b;
}
} a1;
add a2;
int main()
{
add a3;
a1.getdata();  //global object
a2.getdata();  //global object
a3.getdata();
cout << a1 .sum;  //Local object for a global class
cout << a2.sum;
cout << a3.sum;
return 0;   //public data member accessed from outside the class
}
Output:
151515

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 2.
Write about private, protected, and public members of a class.
Answer:
The Public Members:
A public member is accessible from anywhere outside the class but within a program.

The Private Members:
A private member cannot be accessed from outside the class. Only the class member functions can access private members. By default, all the members of a class would be private.

The Protected Members:
A protected member is very similar to a private member but they can be accessed in child classes which are called derived classes (inherited classes).

Question 3.
What is a constructor?
Answer:
The definition of a class only creates a new user-defined data type. The instances of the class type should be instantiated (created and initialized). Instantiating objects is done using the constructor. An array or a structure in C++ can be initialized during the time of their declaration.

The initialization of a class type object at the time of declaration similar to a structure or an array is not possible because the class members have their associated access specifiers (private or protected or public). Therefore Classes include special member functions called constructors. The constructor function initializes the class object.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 4.
Explain memory allocation of objects.
Answer:
Memory allocation of objects:
All the objects belonging to that class use the same member function, no separate space is allocated for member functions when the objects are created.
Memory space required for the member variables are only allocated separately for each object because the member variables will hold different data values for different objects.
Memory for Objects for p1 and p2 is illustrated:
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 5

Question 5.
Explain the default constructor with an example.
Answer:
A constructor that accepts no parameter is called the default constructor. For example in the class data program Data::Data() is the default constructor. Using this constructor objects are created similar to the way the variables of other data types are created.

Example:
int num; //ordinary variable declaration
Data d1; // object declaration

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 6.
How will you refer members of the class? Give its syntax and an example.
Answer:
The members of a class are referenced (accessed) by using the object of the class followed by the dot (membership) operator and the name of the member.

The general syntax for calling the member function is:
Object_name.function_name (actual parameter); For example consider the following illustration:
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 6

Question 7.
Explain the different methods of passing an object to the function argument.
Answer:
Pass By Value:
When an object is passed by value the function creates its own copy of the object and works on it. Therefore any changes made to the object inside the function do not affect the original object.

Pass By Reference:
When an object is passed by reference, its memory address is passed to the function so the called function works directly on the original object used in the function call. So any changes made to the object inside the function definition are reflected in the original object.

Question 8.
Write about constructor.
Answer:
When an instance of a class comes into scope, a special function called the constructor gets executed. The constructor function name has the same name as the class name. The constructors return nothing. They are not associated with any data type. It can be defined either inside class definition or outside the class definition.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 9.
What is a parameterized constructor?
Answer:
Parameterized Constructors:
A constructor which can take arguments is called a parameterized constructor. This type of constructor helps to create objects with different initial values. This is achieved by passing parameters to the function.

Example:
class simple
{
private:
int a,b;
public:
simple(int m, int n)
{
a= m ;
b= n;
cout< < “\n Parameterized Constructor of class-simple
}
};

Question 10.
What do you mean by the implicit and explicit call of a constructor?
Answer:
Implicit call:
In this method, the parameterized constructor is invoked automatically whenever an object is created.
For example, simple s1(10,20); in this for creating the object si parameterized constructor is automatically invoked

Explicit call:
In this method, the name of the constructor is explicitly given to invoking the parameterized constructor so that the object can be created and initialized.

For example:
simple s1=simple(10,20); //explicit call

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 11.
When copy constructor Is executed? Give examples.
Answer:
A copy constructor is called

  • When an object is passed as a parameter to any of the member functions
    Example: void simple: :putdata(simple x);
  • When a member function returns an object
    Example: simple get data( ) { }
  • When an object is passed by reference to an instance of its own class
    For example: simple1, s2(s1); // s2(s1) calls copy constructor

Explain in Detail (5 Marks)

Question 1.
Explain how to define class members?
Answer:
Definition of class members:
Class comprises of members. Members are classified as Data Members and Member functions.

  • Data members are the data variables that represent the features or properties of a class.
  • Member functions are the functions that perform specific tasks in a class.
  • Member functions are called methods, and data members are also called attributes.

Example:

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 7
Defining methods of a class:
Without defining the methods (functions), class definition will become incomplete. The member functions of a class can be defined in two ways.

  • Inside the class definition
  • Outside the class definition

Inside the class definition:
When a member function is defined inside a class, it behaves like inline functions. These are called Inline member functions.

Outside the class definition:
When Member function defined outside the class just like normal function definition (Function definitions you are familiar with) then it is being called as an outline member function or non-inline member function. Scope resolution operator (::) is used for this purpose.

The syntax for defining the outline member function is:
return_type class_name :: function name (parameter list)
{
function definition
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 8

Class using Inline and Outline member function:
# include<iostream>
using namespace std;
class Box
{
// no access specifier mentioned
double width;
public:
double length;
//inline member function definition
void printWidth( )
{
cout<<“\n The width of the box is…”<<width;
}
//prototype of the function
void setWidth(double w);
};
// outline member function definition
void Box :: setWidth(double w)
{
width=w;
}
int main( )
{
// object for class Box
Box b;
// Use member function to set the width.
b.setWidth(10.0);
//Use member function to print the width.
b.printWidth( );
return 0;
Output
The width of the box is… 10

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 2.
What are the ways to create an object using the parameterized constructor with an example?
Answer:
There are two ways to create an object using the parameterized constructor:
1. Implicit call: In this method, the parameterized constructor is invoked automatically whenever an object is created. For example, simple s1( 10,20); in this, for creating the object s1 parameterized constructor is automatically invoked.

2. Explicit call: In this method, the name of the constructor is explicitly given to invoking the parameterized constructor so that the object can be created and initialized.

#include
using namespace std;
class simple
{
private:
int a, b;
public:
simple(int m,int n)
{
a = m;
b = n;
cout << “\n Constructor of class – simple invoked for implicit and explicit call” << endl;
}
void putdata()
{
cout << “\n The two integers are…” << a << ‘\t’ << b << endl;
cout << “\n The sum of the variables” << a << “+” << b << “=” << a + b;
}
};
int main()
{
simple s1(10,20); //implicit call
simple s2 = simple(30,45); //explicit call
cout << “\n\t\tObject 1\n”;
s1.putdata();
s2.putdata();
return 0;
}
Output:
Constructor of class – simple invoked for the implicit and explicit call
Constructor of class-simple invoked for the implicit and explicit call

Object 1
The two integers are… 10 20
The sum of the variables 10 + 20 = 30

Object 2
The two integers are… 30 45.
The sum of the variables 30 + 45 = 75

Question 3.
What are the characteristics of a destructor?
Answer:
Characteristics of destructors:

  • The destructor has the same name as that of the class prefixed by the tilde character
  • The destructor cannot have arguments.
  • It has no return type.
  • Destructors cannot be overloaded i.e., there can be only one destructor in a class.
  • In the absence of a user-defined destructor, it is generated by the compiler.
  • The destructor is executed automatically when the control reaches the end of the class scope to destroy the object.
  • They cannot be inherited.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Evaluate Yourself

Question 1.
Define a class in general and in C++’s context.
Answer:
Classes represent real-world entities that not only have data type properties but also have associated operations.
In C++ class is a way to bind the data and its associated functions together. It is a user-defined data type.

Question 2.
What is the purpose of a class specifier?
Answer:
Data hiding is one of the important features of Object Oriented Programming which allows preventing the functions of a program to access directly the internal representation of a class type.
The access restriction to the class members is specified by class specifies like public, private, and protected sections within the class body.

Question 3.
Compare a structure and a class in C++ context.
Answer:
The only difference between structure and class is the members of structure are by default public where as it is private in class.

Question 4.
Compare private and public access specifier.
Answer:
Public members:
A public member is accessible from anywhere outside the class but within a program. We can set and get the value of public data members even without using any member function.

Private members:
A private member cannot be accessed from outside the class. Only the class member functions can access private members. By default all the members of a class would be private.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 5.
What is a non-inline member function? Write its syntax.
Answer:
When Member function defined outside the class just like normal function definition (Function definitions you are familiar with) then it is being called as an outline member function or non-inline member function. Scope resolution operator (::) is used for this purpose.
The syntax for defining the outline member function is:
Syntax:
return_type class_name :: function_name (parameter list)
{
function definition
}
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 9

Activity – 1
State the reason for the invalidity of the following code fragment.

(i)

(ii)

class count
{
int first
int second;
public:
int first
};
class item
{
int prd;
};
int prdno;

Answer:

  • Data member first is duplicated and it is defined with two scopes( both private and public). It is invalid.
  • Object name prefix with the only class name. No data type allowed in between class name and object name.

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Activity – 2
class area
{
int s;
public:
void calc( );
};
Write an outline function definition for calc( ); which finds the area of a square
Answer:
int area :: calc( ) .
{
return(s * s);
}

Activity – 3
Identify the error in the following code fragment
class A
{
float x;
void init( )
{
Aa1;
X1.5=1; .
}
};
void main( )
{
A1.init( );
}
Answer:
Error:
Local object can not be accessed from outside the function. Al is the local object, so it can not be accessed in main( );

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Activity – 4
What is the size of the objects s1, s2?
class sum
{
int n1,n2;
public:
void add( )
{
int n3=10;n1=n2=10;
}
} s1,s2;
Answer:
The size of the object SI and S2 is 8 bytes each in Dev C++, In Turbo C++ 4 bytes each.
Program to test the memory requirement:
class sum
{
int n1,n2;
public:
void add( )
{
int n3-10;
n1=n2=10;
}
} s1,s2;
using namespace std;
#include<iostream>
int main( )
{
cout<<sizeof(s1)<< “”<<sizeof(s2);
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 10

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Activity – 5
i) Write member function called display with no return.
class objects.
ii) Try the output of the above coding with the necessary modifications.
PROGRAM
#indude<iostream>
using namespace std;
class compute
{
int n1, n2;
public :
void init (int a, int b)
{
n1 = a;
n2 = b;
}
int n;
int add ( )
return (n1+n2);;
{
int prd ( )
{
return (n1*n2);
}
};
compute c1, c2;
void display(compute &objl,compute &obj2)
{
c1.init(12,15);
c2.init(8,4);
objlm = obj1.add( );
obj2.n = obj2.add( );
cout<<“\n Sum of object-1 “<<obj1.n;
cout<<“\n Sum of object-2 “<<obj2.n;
cout<<“\n Sum of the two objects are”<<obj1.
n+obj2.n;
c1.init(5,4);
c2.init(2,5);
obj1.n = obj1.prd( );
obj2.n = obj2.prd( );
cout<<“\n Product of object-1 “<<objl.n;
cout<<“\n Product of object-2 “<<obj2.n;
cout<<“\n Product of the two objects are “<<objl.n*obj2.n;
}
int main( )
{
display(c1,c2);
return 0;
}
output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 11

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Activity – 6
#include<iostream>
using namespace std;
class Sample
{
int i,j;
public :
int k;
Sample( )
{
i=j=k=0;//constructor defined inside the class
}
};
int main( )
{
Sample s1;
return 0;
}
Output
In the above program justify your reason for no output.
Answer:
Constructor alone is defined without output statement. When the above program is executed, the constructor executed. But no output on the screen because of missing cout

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Hands-On Practice

Question 1.
Define a class employee with the following specification.
Answer:
private members of class Employee
empno- integer
ename – 20 characters
basic-float
netpay, hra, da, – float
calculate ( ) – A function to find the basic+hra+da with float return type

public member functions of class employee
havedata( ) – A function to accept values for empno, ename, basic, hra,
da and call calculate( ) to compute netpay
dispdata( ) – A function to display all the data members on the screen
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
class Employee
{
private :
int empno;
char ename[20];
float basic,hra,da,netpay;
float calculate( )
{
return (basic+hra+da);
}
public:
void have data( )
{
cout<<setw(35)<<“Enter Employee number :”;
cin>>empno;
cout<<setw(35)<<“Enter Employee name :”;
cin>>ename;
cout<<setw(35)<<“Enter Basic pay :”;
cin>>basic; ,
cout<<setw(35)<<“Enter House Rent Allowance (HRA):”;
cin>>hra; .
cout<<setw(35)<<“Enter Dearness Allowance (DA):”;
cin>>da;
netpay = calculate( );
}
void dispdata( )
{
cout<<“\nEMPLOYEE DETAILS\n\n”;
cout<<setw(35)<<“Employee number :”<<empno<<endl;
cout<<setw(35)<<“Employee name :”<<ename<<endl;
cout<<setw(35)<<“Basic pay :”<<basic<<endl;
cout<<setw(35)<<“House Rent Allowance (HRA) :”<<hra<<endl; cout<<setw(35)<<“Dearness Allowance (DA) :”<<da<<endl;
cout<<setw(35)< <“Netpay :”<<netpay<<endl;
}
};
int main( )
{
Employee e;
e.havedata( );
e.dispdata( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 12

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 2.
Define a class MATH with the following specifications.
Answer:
private members:
num1, num2, result – float
init( ) function to initialize num1, num2 and result to zero .

protected members:
add( ) function to add num1 and num2 and store the sum in result
diff( ) function to subtract num1 from num2 and store the difference in the result

public members:
getdata( ) function to accept values for num1 and num2
menu( ) function to display menu
1. Add…
2. Subtract…
invoke add() when the choice is 1 and invoke prod when the choice is 2 and also display the result.
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
class MATH
{
private:
float num1,num2,result;
init( )
{
num1=0;
num2=0;
result=0;
}
protected: void add( )
{
result = num1+num2;
}
void diff( )
{
result = num1 – num2;
}
public:
getdata( )
{
cout<<“\nEntertwo numbers “;
cin>>num1>>num2;
} ‘ menu( )
{
int choice;
cout<<“\n1.Add …”;
cout<<“\n2.Subtract …….”;
cout<<“\nEnter your choice :”; cin>>choice;
switch(choice)
{
case 1: getdata( );
add( );
cout<<“\nAdded value is”<<result;
break;
case 2: getdata( );
diff( );
cout<<“\nSubtracted value is “<<result;
break;
default: cout<<“\End”;
}
}
};
int main( )
{
MATH m;
m. menu( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 13

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 3.
Create a class called Item with the following specifications.
Answer:
private members:
code, quantity- Integer data type
price – Float data type
getdata( )-function to accept values for all , data members with no return

public members:
taxt – float
dispdata( ) member function to display code,quantity,price and tax .The tax is calculated as if the quantity is more than 100 tax is 2500 otherwise 1000.
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
class Item
{
private:
int code,quantity;
float price;
void getdata( )
{
cout<<“\nEnter product code “; cin>>code;
cout<<“\nEnter quantity “; cin>>quantity;
cout<<“\nEnter price “; cin>> price;
}
public:
float tax;
void display( )
{
getdata( );
if(quantity>100)
tax = 2500;
else
tax = 1000;
cout<<endl<<setw(25)<< “Product code : “<<code<<endl<<endl;
cout<<setw(25)<<“Quantity : ” <<quantity<<endl<<endl;
cout<<setw(25)<<“Unit price :” <<price<<endl<<endl;
cout<<setw(25)<<“Total Amount: ” < cout<<setw(25)<<“Net Bill amount : ”
<<quantity* price+tax<<endl<<endl;
}
};
int main( )
{
Item i; i.display( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 14

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 4.
Write the definition of a class FRAME in C++ with the following description.
Answer:
Private members:
FramelD – Integer data type
Height, Width, Amount – Float data type
SetAmount( ) -Member function to calculate and assign amount as 10*Height*Width

Public members:
GetDetail( ) Afunction to allow user to entervalues of FramelD, Height, Width. This function should also call SetAmount() to calculate the amount.
ShowDetail( ) A function to display the values of all data members.
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
class FRAME
{
private:
int FrameId;
float Height, Width, Amount;
void SetAmount()
{
Amount = 10 * Height * Width;
}
public:
void Getdetails( )
{
cout<<“\nEnter Frame Id : “; cin>> FrameId;
cout<<“\nEnter Frame Height: cin>> Height;
cout<<“\nEnter Frame Width : “; cin>>Width;
SetAmount( );
}
void ShowDetaiis( )
{
cout<<endl<setw(25)<<“Frame Id :” <<FrameId<<endl<<endl; cout<<setw(25)<<“Frame Height:” <<Height<<endl<endl;
cout<<setw(25)<<“Frame Width :”<<Width<<endk<endl;
cout<<setw(25)<<“Total Amount:”
<<Amount< <endl< <endl;
}
int main( )
{
FRAME F;
F.Getdetails( );
F.ShowDetails( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 15

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 5.
Define a class RESORT in C++ with the following description:
Answer:
Private Members:
Rno //Data member to store Room No
RName //Data member to store customer name
Charges //Data member to store per day charges Days //Data member to store a number of days of stay
COMPUTE( ) //A function to calculate and return Amount as
//Days*Chagres and if the value of Days*Charges is more than 5000 then as 1.02*Days*Charges

Public Members:
Getinfo( ) //A function to enter the content Rno, Name, Charges //and Days Displayinfo( ) //A function to display Rno, RName, Charges, Days and
// Amount (Amount to displayed by calling function COMPUTE())
PROGRAM
using namespace std;
#include<iostream>
class RESORT
{
private:
int Rno,Days,Charges;
char Rname[20];
int compute( )
{
if (Days * Charges >5000)
return (Days * Charges * 1.02);
else
return(Days * Charges);
}
public:
getinfo( )
{
cout<<“\nEnter customer name :”;
cin>>Rname;
cout<<“\nEnter charges per day :”;
cin>>Charges;
cout<<“\nEnter Number of days :”;
cin>>Days;
cout<<“\nEnter Room Number :”;
cin>>Rno;
}
dispinfo( )
{
cout<<“\nRoom Number : “<<Rno;
cout<<“\nCustomer name :
“<<Rname;
cout«”\nCharges per day :
“<<Charges;
cout<<“\nNumber of days :
“<<Days;
cout<<“\nTotal Amount :
“<<compute( );
}
};
int main( )
{
RESORT Obj;
Obj.getinfo( );
Obj.dispinfo( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 16

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 7.
Answer:
struct pno
{
int pin;
float balance;
}
Create a BankAccount class with the following specifications

protected members
pno_obj //array of 10 elements
init(pin) // to accept the pin number and initialize it and initialize
// the balance amount is 0

public members
deposit(pin, amount):
Increment the account balance by accepting the amount and pin. Check the pin number for matching. If it matches increment the balance and display the balance else display an appropriate message withdraw(self, pin, amount):
Decrement the account balance by accepting the amount and pin. Check the pin number for matching and balance is greater than 1000 and amount is less than the balance. If it matches withdraw the amount and display the balance else display an appropriate message
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
struct pno
{
int pin;
float balance;
};
class BankAccount
{
public:
pno pno_obj[10];
void deposit(int pn,float amt)
{
for(int i=0;i<10;i++)
if(pno_obj[i].pin == pn)
{
pno_obj[i].balance = pno_obj[i].balance + amt;
cout<<“\nTransaction successful!
cout<<“\nBalance amount in your account is”<< pno_obj[i].balance; break;
}
void withdraw(int self,int pn,float amt)
{
for(int i=0;i<10;i++)
{
if(pno_obj[i].pin== pn)
{
if (pno_obj[i].balance>1000 && amt < pno_obj[i].balance)
{
pno_obj[i].balance=pno_obj[i]. balance- amt;
cout<<“\nTransaction successful”;
cout<<“\nBalance amount in your account is “<< pno_obj[i].balance; break;
}
} }
}
};
int main( )
{
int pin_no, tamt;
BankAccount b;
// initialization of objects with pin and balance amount as 0
for(int i=0;i<10;i++)
{
b.pno_obj[i].pin=i+l;
}
int choice;
while(choice !=3)
{
cout <<“\n1. Deposit”;
cout <<“\n2.Withdrawal”;
cout<<“\n3.Exit”;
cout<<“\nEnter your choice “; cin >>choice;
switch(choice)
{
case 1:
cout<<“\nEnter PIN
cin>>pin_no;
cout<<“\nEnter Deposit amount”;
cin>>tamt;
b.deposit(pin_no,tamt); break;

case 2:
cout<<“\nEnter PIN cin>>pin_no;
cout<<“\nEnter Withdrawal amount”;
cin>>tamt;
cout<<“\nEnter 1 for Self 2 for Others :”;
int type;
cin>>type;
b.withdraw(type,pin_no,tamt); break;
default: cout<<“\nTransaction completed”;
}
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 17

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 8.
Define a class Hotel in C++ with the following description:
Answer:
Private Members:
Rno //Data member to store Room No
Name //Data member t store customer name
Charges //Data member to store per day charges
Days //Data member to store number of days of stay
Calculate() //A function to calculate and return Amount as
//Days*Chagres and if the value of Days*Charges is more than 12000 then as 1.2*Days*Charges

Public Members:
Hotel( ) //to initialize the class members
Getinfo( ) //A function to enter the content Rno, Name, Charges //and Days
Showinfo( ) //A function to display Rno, RName, Charges, Days and
//Amount (Amount to displayed by calling function CALCULATE( ))
PROGRAM
using namespace std;
#include<iostream>
#include<string.h>
class Hotel
private:
int Rno,Days,Charges;
char Name[20];
1 int Calculate( )
{
if (Days * Charges >12000)
return (Days * Charges * 1.02);
else
return(Days * Charges);
}
public:
Hotel( )
{
Rno=0;
Days=0;
Charges=0;
strcpy(Name,””);
}
void Getinfo( )
{
cout<<“nEnter customer name :”;
cin>>Name;
cout<<“nEnter charges per day : “;
cin>>Charges;
cout<<“\nEnter Number of days :”;
cin>>Days;
cout<<“\nEnter Room Number :”;
cin>>Rno;
}
void Showinfo( )
{
cout<<“\nRoom Number: “<<Rno;
cout<<“\nCustomer name : “<<Name;
cout<<“\nCharges per day : “<<Charges;
cout<<“\nNumber of days : “<<Days;
cout<<“\nTota! Amount: “<<Calculate( );
}
};
int main( )
{
Hotel obj;
obj.Getinfo( );
obj.Showinfo( )
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 18

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 9.
Define a class Exam in C++ with the following description:
Answer:
Private Members:
Rollno – Integer data type
Cname – 25 characters
Mark – Integer data type

public:
Exam(int,char[],int) //to initialize the object ~Exam() // display message “Result will be intimated shortly”
void Display( ) // to display all the details if the mark is above 60 other wise display “Result Withheld”
PROGRAM
using namespace std;
#include<iostream>
#include<string.h>
class Exam
{
private:
int Rollno,Mark;
char Cname[25];
public:
Exam(int r,char n[25],int m)
{
Rollno = r;
Mark = m;
strcpy(Cname,n);
}
~Exam( )
{
cout<<“\n\nResult will be intimated shortly”;
}
void Display( )
{
if (Mark>60)
{
cout<<“\n\nRoll Number : “<<Rollno;
cout<<“\nCandidate name : “<<Cname;
cout<<“\nMark :”<<Mark;
}
else
{
cout<<“\n\nRoll Number : “<<Rollno;
cout<<“\nCandidate name : “<<Cname;
cout<<“\nResult Withheld”;
}
}
};
int main( )
{
Exam obj 1(1011,”SURYA”,78),obj2( 1012,”JOHN”,44);
objl.Display( );
obj2. Display( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 19

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Question 10.
Define a class Student in C++ with the following specification:
Answer:
Private Members:
A data member Rno(Registration Number) type long
A data member Cname of type string A data member Agg_marks (Aggregate Marks) of type float
A data member Grade of type char
A member function setGrade () to find the grade as per the aggregate marks obtained by the student. Equivalent aggregate marks range and the respective grade as shown below.
Aggregate Marks -Grade
>=90 – A
Less than 90 and >=75 – B
Less than 75 and >=50 – C
Less than 50 – D
Public members:
A constructor to assign default values to data members:
A copy constructor to store the value in another object
Rno=0, Cname=”N.A” Agg_marks=0,0
A function Getdata ( ) to allow users to enter values for Rno.Cname, Aggjnarks and call functionsetGrade ( ) to find the grade.
A function dispResult( ) to allow user to view the content of all the data members.
A destructor to display the message “END”
PROGRAM .
using namespace std;
#include<iostream>
#include<string.h>
#include<iomanip>
class Student
{
private:
long Rno;
char Cname[25],Grade;
float Agg_marks;
void Setgrade()
{
if (Ag g_ma rks >=90)
Grade = ‘A’;
else if(Agg_marks>=75)
Grade = ‘B’;
else if(Agg_marks>=50)
Grade = ‘C’;.
else
Grade = ‘D’;
}
public:
Student( )
{
Rno = 0;
Agg_marks = 0;
strcpy(Cname,””);
Grade=”;
}
Student(Student &s) .
{
Rno = s.Rno;
Agg_marks = s.Agg_marks;
strcpy(Cname,s.Cname);
Grade=s.Grade;

~Student( )
{
cout<<“\nEND”; >
void Getdata( )
{
cout<<“\nEnter Register Number”;
cin>>Rno;
cout<<“\nEnter Candidate Name
cin>>Cname;
cout<<“\nEnter Aggrigate Mark”;
cin>>Agg_marks;
Setgrade( );
}
void dispResult( )
{
cout<<setw(30)<<“Candidate Register Number
“<<Rno<<endl<<endl;
cout< <setw(30)<< “Candidate Name : “<<Cname<<endk<endI;
cout<<setw(30)<<“Aggrigate Mark : “<<Agg_marks«endk<endl;
cout<<setw(30)<<“Grade :
“<<Grade<<endk<endl;
}
};
int main( )
{
Student s1;
s1.Getdata( );
Student s2(s1);
COut<<“\nFIRST CANDIDATE DETAIL \n\n”; s1.dispResult( );
cout<<“\nSECOND CANDIDATE DETAIL \n\n”;
s2.dispResult( );
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects 20

Samacheer Kalvi 11th Computer Science Guide Chapter 14 Classes and Objects

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 13 Introduction to Object-Oriented Programming Techniques Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 13 Introduction to Object-Oriented Programming Techniques

11th Computer Science Guide Introduction to Object-Oriented Programming Techniques Text Book Questions and Answers

Book Evaluation

Part I

Choose The Correct Answer

Question 1.
The term is used to describe a programming approach based on classes and objects is
a) OOP
b) POP
c) ADT
d) SOP
Answer:
a) OOP

Question 2.
The paradigm which aims more at procedures.
a) Object Oriented Programming
b) Procedural programming
c) Modular programming
d) Structural programming
Answer:
b) Procedural programming

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 3.
Which of the following is a user defined data type?
a) class
b) float
c) int
d) object
Answer:
a) class

Question 4.
The identifiable entity with some characteristics and behaviour is.
a) class
b) object
c) structure
d) member
Answer:
b) object

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 5.
The mechanism by which the data and functions are bound together into a single unit is known as
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Abstraction
Answer:
b) Encapsulation

Question 6.
Insulation of the data from direct access by the program is called as
a) Data hiding
b) Encapsulation
c) Polymorphism
d) Abstraction
Answer:
a) Data hiding

Question 7.
Which of the following concept encapsulate all the essential properties of the object that are to be created?
a) class
b) Encapsulation
c) Polymorphism
d) Abstraction
Answer:
d) Abstraction

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 8.
Which of the following is the most important advantage of inheritance?
a) data hiding
b) code reusability
c) code modification
d) accessibility
Answer:
b) code reusability

Question 9.
“Write once and use it multiple time” can be achieved by
a) redundancy
b) reusability
c) modification
d) composition
Answer:
b) reusability

Question 10.
Which of the following supports the transitive nature of data?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Abstraction
Answer:
a) Inheritance

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Part – II

Very Short Answer

Question 1.
How is modular programming different from the procedural programming paradigm?
Answer:
Modular programming:

  • Emphasis on the algorithm rather than data.
  • Programs are divided into individual modules.
  • Each modules are independent of each other and have their own local data.
  • Modules can work with their own data as well as with the data passed to it.

Procedural programming:

  • Programs are organized in the form of subroutines or subprograms.
  • All data items are global.
  • Suitable for a small-sized software applications.
  • Difficult to maintain and enhance the program code as any change in data type needs to be propagated to all subroutines that use the same data type.

Question 2.
Differentiate classes and objects.
Answer:
Class: A Class is a construct in C++ which is used to bind data and its associated function together into a single unit using the encapsulation concept. Class is a user-defined data type.

Object: An identifiable entity with some characteristics and behaviour is called an object.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 3.
What is polymorphism?
Answer:
Polymorphism is the ability of a message or function to be displayed in more than one form.

Question 4.
How are encapsulation and abstraction are interrelated?
Answer:
The mechanism by which the data and functions are bound together into a single unit is known as Encapsulation. It implements abstraction.
Abstraction refers to showing only the essential features without revealing background details.

Question 5.
Write the disadvantages of OOP.
Answer:

  1. Size: Object-Oriented Programs are much larger than other programs.
  2. Effort: Object-Oriented Programs require a lot of work to create.
  3. Speed: Object-Oriented Programs are slower than other programs, because of their size.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Part – III

Short Answers

Question 1.
What is a paradigm? Mention the different types of paradigm.
Answer:
The paradigm means organizing principle of a program. It is an approach to programming.
There are different approaches available for problem-solving using computers. They are:

  • Procedural programming,
  • Modular Programming and
  • Object-Oriented Programming.

Question 2.
Write a note on the features of procedural programming.
Answer:
Important features of procedural programming

  1. Programs are organized in the form of subroutines or subprograms
  2. All data items are global
  3. Suitable for small-sized software application
  4. Difficult to maintain and enhance the program code as any change in data type needs to be propagated to all subroutines that use the same data type. This is time-consuming.
  5. Example: FORTRAN and COBOL.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 3.
List some of the features of modular programming
Answer:
Important features of modular programming:

  • Emphasis on the algorithm rather than data.
  • Programs are divided into individual modules.
  • Each modules are independent of each other and have their own local data.
  • Modules can work with its own data as well as with the data passed to it.
  • Example: Pascal and C.

Question 4.
What do you mean by modularization and software reuse?
Answer:

  1. Modularization: where the program can be decomposed into modules.
  2. Software reuse: where a program can be composed of existing and new modules.

Question 5.
Define information hiding.
Answer:
The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it.These functions provide the interface between the object’s data and the program.
This encapsulation of data from direct access by the program is called data hiding or information hiding.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Part-IV

Explain in Detail

Question 1.
Write the differences between object-oriented programming and procedural programming.
Answer:
Object-Oriented Programming:

  • Emphasizes data rather than algorithms.
  • Data abstraction is introduced in addition to procedural abstraction.
  • Data and its associated operations are grouped into a single unit.
  • Programs are designed around the data being operated.
  • Example: C++, Java, VB.Net, Python

Procedural Programming:

  • Programs are organized in the form of subroutines or subprograms.
  • All data items are global.
  • Suitable for a small-sized software application.
  • Difficult to maintain and enhance the program code as any change in data type needs to be propagated to all subroutines that use the same data type.
  • Example: FORTRAN and COBOL

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 2.
What are the advantages of OOPs?
Answer:
Advantages of OOP Re-usability:
“Write once and use it multiple times” you can achieve this by using class.

Redundancy:
Inheritance is a good feature for data redundancy. If you need the same functionality in multiple classes you can write a common class for the same functionality and inherit that class to sub-class.

Easy Maintenance:
It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.

Security:
Using data hiding and abstraction only necessary data will be provided thus maintains the security of data.

Question 3.
Write a note on the basic concepts that support OOPs?
Answer:
Object-Oriented Programming has been developed to overcome the drawbacks of procedural and modular programming. It is widely accepted that object-oriented programming is the most important and powerful way of creating software.

The Object-Oriented Programming approach mainly encourages:

  1. Modularization: where the program can be decomposed into modules.
  2. Software reuse: where a program can be composed of existing and new modules.

Main Features of Object-Oriented Programming:

  1. Data Abstraction
  2. Encapsulation
  3. Modularity
  4. Inheritance
  5. Polymorphism

Encapsulation:
The mechanism by which the data and functions are bound together into a single unit is known as Encapsulation. It implements abstraction. Encapsulation is about binding the data variables and functions together in class. It can also be called data binding. Encapsulation is the most striking feature of a class.

The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. This encapsulation of data from direct access by the program is called data hiding or information hiding.

Data Abstraction:
Abstraction refers to showing only the essential features without revealing background details. Classes use the concept of abstraction to define a list of abstract attributes and function which operate on these attributes. They encapsulate all the essential properties of the object that are to be created. The attributes are called data members because they hold information. The functions that operate on these data are called methods or member functions.

Modularity:
Modularity is designing a system that is divided into a set of functional units (named modules) that can be composed into a larger application.

Inheritance:
Inheritance is the technique of building new classes (derived class) from an existing class (base class). The most important advantage of inheritance is code reusability.

Polymorphism:
Polymorphism is the ability of a message or function to be displayed in more than one form.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

11th Computer Science Guide Introduction to Object-Oriented Programming Techniques Additional Questions and Answers

Choose The Correct Answer (1 Mark)

Question 1.
In procedural programming all data items are ……………….
(a) Cobol
(b) global
(c) fortran
(d) class
Answer:
(b) global

Question 2.
The object-oriented paradigm allows us to organize software as a collection of objects that consist of …………………..
a) Data
b) Behaviour
c) Both data and behaviour
d) None of these
Answer:
c) Both data and behaviour

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 3.
………………. is an example of object-oriented programming.
(a) Python
(b) Java
(c) VB.Net
(d) All the above
Answer:
(d) All the above

Question 4.
Paradigm means ………………..
a) Organizing principle of a program
b) An approach to programming
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 5.
………………. is about binding the data variables and functions together in class.
(a) Data abstraction
(b) Modularization
(c) Redundancy
(d) Encapsulation
Answer:
(d) Encapsulation

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 6.
In ………………. approach programs are organized in the form of subroutines or subprograms.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
b) Procedural Programming

Question 7.
…………………. approach of the program is time-consuming.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
b) Procedural Programming

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 8.
……………… language is based on procedural programming.
a) FORTRAN
b) COBOL
c) Both A and B
d) C++
Answer:
c) Both A and B

Question 9.
…………….. paradigm consists of multiple modules; each module has a set of functions of related types.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
a) Modular Programming

Question 10.
In ……………… approach data is hidden under the modules
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
a) Modular Programming

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 11.
______ language is based on modular programming.
a) Pascal
b) C
c) Both A and B
d) C++
Answer:
c) Both A and B

Question 12.
………………. paradigm emphasizes the data rather than the algorithm.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
c) Object-Oriented Programming

Question 13.
………………… implements programs using classes and objects.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
c) Object-Oriented Programming

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 14.
A …………….. is a construct in C++ which is used to bind data and its associated function together into a single unit.
a) Class
b) Structure
c) Array
d) None of these
Answer:
a) Class

Question 15.
A Class is a construct in C++ which uses the ……………….. concept.
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer:
b) Encapsulation

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 16.
Class is a ……………… data type.
a) User-defined
b) Derived
c) Primitive
d) None of these
Answer:
a) User-defined

Question 17.
…………………. can be defined as a template or blueprint representing a group of objects that share common properties and relationship.
a) Class
b) Structure
c) Array
d) None of these
Answer:
a) Class

Question 18.
……………….. are the basic unit of OOP.
a) Attributes
b) Objects
c) Members
d) None of these
Answer:
b) Objects

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 19.
The class variables are called……………………
a) Instances
b) Objects
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 20.
An identifiable entity with some characteristics and behaviour is called ………………
a) Instances
b) Objects
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 21.
In ……………… method, programs are designed around the data being operated.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
c) Object-Oriented Programming

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 22.
………………… language is based on object-oriented programming.
a) C++, Java
b) VB.Net
c) Python
d) All the above
Answer:
d) All the above

Question 23.
……………… is widely accepted that object-oriented programming is the most important and powerful way of creating software.
a) Modular Programming
b) Procedural Programming
c) Object-Oriented Programming
d) All the above
Answer:
c) Object-Oriented Programming

Question 24.
The Object-Oriented Programming approach mainly encourage ______
a) Modularisation
b) Software re-use
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 25.
…………………….. means the program can be decomposed into modules.
a) Modularisation
b) Software re-use
c) Both A and B
d) None of these
Answer:
a) Modularisation

Question 26.
………………… means, a program can be composed of existing and new modules.
a) Modularisation
b) Software re-use
c) Both A and B
d) None of these
Answer:
b) Software re-use

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 27.
The main feature of Object-Oriented Programming is ………………….
a) Data Abstraction and Encapsulation
b) Modularity
c) Inheritance and Polymorphism
d) All the above
Answer:
d) All the above

Question 28.
……………………. implements abstraction.
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer:
b) Encapsulation

Question 29.
……………….. can be called data binding.
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer:
b) Encapsulation

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 30.
……………………… is the most striking feature of a class,
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer:
b) Encapsulation

Question 31.
The encapsulation of data from direct access by the program is called …………………….
a) Data hiding
b) Information hiding
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 32.
…………………… refers to showing only the essential features without revealing background details,
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer:
c) Abstraction

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 33.
The attributes are called ……………………..
a) Data members
b) Methods
c) Member functions
d) Either B or C
Answer:
a) Data members

Question 34.
…………………….. hold information.
a) Data members
b) Methods
c) Member functions
d) Either B or C
Answer:
a) Data members

Question 35.
The functions that operate on data numbers are called …………………..
a) Data members
b) Methods
c) Member functions
d) Either B or C
Answer:
d) Either B or C

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 36.
………………. is designing a system that is divided into a set of functional units.
a) Polymorphism
b) Modularity
c) Abstraction
d) Inheritance
Answer:
b) Modularity

Question 37.
……………………. is the technique of building new classes from an existing class,
a) Polymorphism
b) Modularity
c) Abstraction
d) Inheritance
Answer:
d) Inheritance

Question 38.
In inheritance, the existing class is called as …………………….. class.
a) Base
b) Derived
c) Abstract
d) None of these
Answer:
a) Base

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 39.
In inheritance, the newly created class is called as ………………… class.
a) Base
b) Derived
c) Abstract
d) None of these
Answer:
b) Derived

Question 40.
……………… is the ability of a message or function to be displayed in more than one form.
a) Polymorphism
b) Modularity
c) Abstraction
d) Inheritance
Answer:
a) Polymorphism

Question 41.
……………. means, write once and use it multiple times.
a) Re-usability
b) Redundancy
c) Security
d) None of these
Answer:
a) Re-usability

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 42.
If we need the same functionality in multiple class you will write a common class for the same functionality and inherit that class to subclass is called ……………………
a) Re-usability
b) Redundancy
c) Security
d) None of these
Answer:
b) Redundancy

Question 43.
………………. is a good feature for data redundancy.
a) Polymorphism
b) Modularity
c) Abstraction
d) Inheritance
Answer:
d) Inheritance

Question 44.
…………………… programs are much larger than other programs.
a) Modular
b) Procedural
c) Object-Oriented
d) All the above
Answer:
c) Object-Oriented

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Question 45.
………………….. program requires a lot of work to create.
a) Modular
b) Procedural
c) Object-Oriented
d) All the above
Answer:
c) Object-Oriented

Question 46.
……………… programs .are slower than other programs, because of their size.
a) Modular
b) Procedural
c) Object-Oriented
d) All the above
Answer:
c) Object-Oriented

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Very Short Answers 2 Marks

Question 1.
Write a note on an object-oriented program.
Answer:
Object-Oriented Programming (OOP) is the term used to describe a programming approach based on classes and objects. The object-oriented paradigm allows us to organize software as a collection of objects that consist of both data and behaviour.

Question 2.
What is modularity?
Answer:
Modularity is designing a system that is divided into a set of functional units (named modules) that can be composed into a larger application.

Question 3.
Define Data binding.
Answer:
Encapsulation is about binding the data variables and functions together in class. It can also be called data binding.

Samacheer Kalvi 11th Computer Science Guide Chapter 13 Introduction to Object-Oriented Programming Techniques

Short Answers (3 Marks)

Question 1.
Write about objects.
Answer:
Objects: Represents data and its associated function together into a single unit. Objects are the basic unit of OOP. Basically, an object is created from a class. They are instances of class also called class variables. An identifiable entity with some characteristics and behaviour is called an object.

Question 2.
What are Encapsulation and data binding?
Answer:
The mechanism by which the data and functions are bound together into a single unit is known as Encapsulation. Encapsulation is the most striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. This encapsulation of data from direct access by the program is called data hiding or information hiding.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 12 Arrays and Structures Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 12 Arrays and Structures

11th Computer Science Guide Arrays and Structures Text Book Questions and Answers

Book Evaluation

Part I

Choose The Correct Answer

Question 1.
which of the following is the collection of variables of the same type that are referenced by a common name ?
a) int
b) float
c) Array
d) class
Answer:
c) Array

Question 2.
Array subscripts is always starts with which number ?
a) -1
b) 0
c) 2
d) 3
Answer:
b) 0

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 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:
b) 5

Question 4.
cin>>n[3]; To which element does this statement accepts the value?
a) 2
b) 3
c) 4
d) 5
Answer:
c) 4

Question 5.
By default, the string end with which character?
a) \0
b) \t
c) \n
d) \b
Answer:
a) \0

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Part – II

Very Short Answers

Question 1.
What is Traversal in an Array?
Answer:
Accessing each element of an array at least once to perform any operation is known as “Traversal”. Displaying all the elements in an array is an example of “traversal”.

Question 2.
What is Strings?
Answer:
A string is defined as a sequence of characters where each character may be a letter,’ number or a symbol.
Every string is terminated by a null (\0) character which must be. appended at the end of the string.

Question 3.
What is the syntax to declare two – dimensional array? ‘
Answer:
The declaration of a 2-D array is
datatype array_name[row – size] [col – size];
In the above declaration, data-type refers to any valid C++ data – type, array _ name refers to the name of the 2 – D array, row – size refers to the number of rows and col-size refers to the number of columns in the 2 – D array.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Part – III

Short Answers

Question 1.
Define an Array. What are the types?
Answer:
An array is a collection of variables of the same type that are referenced by a common name.
There are different types of arrays used in C++. They are:

  • One-dimensional arrays
  • Two-dimensional arrays
  • Multi-dimensional arrays

Question 2.
With note an Array of strings.
Answer:
An array of strings is a two – dimensional character array. The size of the first Index (rows) denotes the number of strings and the size of the second index (columns) denotes the maximum length of each string. Usually, an array of strings are declared in such a way to accommodate the null character at the end of each string. For example, the 2-D array has the declaration:
char name [7][10];
In the above declaration,
No. of rows = 7;
No. of columns = 10;
We can store 7 strings each with a maximum length of 10 characters.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 3.
Write a C++ program to accept and print your name?
Answer:
PROGRAM
#include<iostream>
using namespace std;
int main( )
{
char str[100];
cout<< “Enter your name :”;
cin.get(str,100);
cout<< “You name is : ” << str <<endl;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 1

Part – IV

Explain In Detail

Question 1.
write a c++ program to find the difference between two matrix.
Answer:
PROGRAM
#include<iostream>
#include<conio.h>
using namespace std;
int main( )
{
int row, col, m1[10][10], m2[10][10], sum[10][10];
cout<<“Enter the number of rows : “;
cin>>row;
cout<<“Enter the number of columns :”;
cin>>col;
cout<< “Enter the elements of first matrix: “<<endl;
for (int i = 0;i<row;i++ )
for (int j = 0;j <col;j++ )
cin>>m1[i][j];
cout< < “Enter the elements of second matrix: “<<endl;
for (int i = 0;i<row;i++ )
for (int j = 0;j<col;j++ )
< cin>>m2[i][j];
cout<<“Output: “<<endl;
for (int i = 0;i<row;i++ )
{
for (int j = 0;j<col;j++ )
{
sum[i][j]=m1[i][j] – m2[i][j]); cout<<sum[i][j]<<“”;
}
cout<<endl<<endl;
}
getch( );
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 2

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 2.
How will you pass two dimensional array to a function explain with example.
Answer:
Passing 2″D array to a function:
C++ program to display values from two dimensional array.
#include<iostream>
using namespace std;
void display (int n[3][2]);
int main( )
{
int num[3][2] = { {3, 4}, {9, 5>, {7, 1} } ;
display(num);
return 0;
}
void display(int n[3][2])
{
cout << “\n Displaying Values” << endl; for (int i=0; i<3; i++)
{
for (int j=0; j<2; j++)
{
cout << n[i][j] << “”;
}
cout << endl << endl;
}
}
Output
Displaying Values
3 4
9 5
7 1
In the above program, the two-dimensional array num is passed to the function display
( ) to produce the results.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

11th Computer Science Guide Arrays and Structures Additional Questions and Answers

Choose The Correct Answer (1 Mark)

Question 1.
The size of the array is referred to as its ………………..
(a) dimension
(b) direction
(c) location
(d) space
Answer:
(a) dimension

Question 2.
…………… is an easy way of storing multiple values of the same type referenced by a common name.
a) Variables
b) Literals
c) Array
d) None of these
Answer:
c) Array

Question 3.
Displaying all the elements in an array is an example of ………………..
(a) memory allocation
(b) call by reference
(c) traversal
(d) none of these
Answer:
(c) traversal

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
A (n) ………………….. is a collection of variables of the same type that are referenced by a common name.
a) Structures
b) Array
c) Unions
d) None of these
Answer:
b) Array

Question 5.
During ……………….. the array of elements cannot be initialized more than its size.
(a) declaration
(b) initialization
(c) assigning
(d) execution
Answer:
(b) initialization

Question 6.
The …………….. of the array is referred to as its dimension.
a) Elements
b) Size
c) Format
d) None of these
Answer:
b) Size

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
Pass an array to a function in C++, the function needs the array name as ………………..
(a) a function
(b) an argument
(c) global object
(d) string
Answer:
(b) an argument

Question 8.
…………………. is a type of arrays used in C++.
a) One-dimensional array
b) Two-dimensional array
c) Multidimensional array
d) All the above
Answer:
d) All the above

Question 9.
A structure without a name tag is called ………………..
(a) homogenous structure
(b) anonymous structure
(c) array of structure
(d) dynamic memory
Answer:
(b) anonymous structure

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 10.
A one-dimensional array represents values that are stored in a single …………….
a) Row
b) Column
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 11.
Array size should be specified with …………………
a) square brackets[ ]
b) Parenthesis ( )
c) Curly braces{ }
d) Angle brackets < >
Answer:
a) square brackets[ ]

Question 12.
In an array declaration, ……………… defines how many elements the array will hold.
a) array_name
b) array_size
c) data_type
d) None of these
Answer:
b) array_size

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 13.
In an array declaration, …………………. declares the basic type of the array, which is the type of each element in the array.
a) array_name
b) array_size
c) data type
d) None of these
Answer:
c) data type

Question 14.
In an array declaration, ……………….. specifies the name with which the array will be referenced
a) array_name
b) array_size
c) data type
d) None of these
Answer:
a) array_name

Question 15.
The array subscript always starts with ………………
a) 0
b) 1
c) -1
d) None of these
Answer:
a) 0

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 16.
The subscript always is a(n) ………………value.
a) Integer
b) Unsigned integer
c) Signed integer
d) float
Answer:
b) Unsigned integer

Question 17.
In Turbo C++, int data type requires …………….. bytes of memory.
a) 4
b) 8
c) 2
d) 1
Answer:
c) 2

Question 18.
In Dev C++, int data type requires ………………. bytes of memory,
a) 4
b) 8
c) 2
d) 1
Answer:
a) 4

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 19.
The memory space allocated for an array can be calculated using the -formula.
a) Number of bytes allocated for the type of array + Number of elements
b) Number of bytes allocated for the type of array x Number of elements
c) Number of bytes allocated for the type of array – Number of elements
d) None of these
Answer:
b) Number of bytes allocated for the type of array x Number of elements

Question 20.
An array can be initialized at the time of its ………………
a) Declaration
b) Process
c) Either A or B
d) None of these
Answer:
a) Declaration

Question 21.
Unless an array is initialized, all the array elements contain ……………..values.
a) Null
b) Default
c) Garbage
d) None of these
Answer:
c) Garbage

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 22.
While declaring and Initializing values In an array, the values should be given within the ……………..
a) square brackets[ ]
b) Parenthesis ()
c) Curly braces{ }
d) Angle brackets < >
Answer:
c) Curly braces{ }

Question 23.
The …………….. of an array may be optional when the array is initialized during declaration.
a) Data type
b) Size
c) Name
d) None of these
Answer:
b) Size

Question 24.
The subscript in the bracket can be a(n) ……………….
a) Variable
b) Constant
c) Expression that evaluates to an integer
d) Either A or B or C
Answer:
d) Either A or B or C

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 25.
Accessing each element of an array at least once to perform any operation is known as ………………..
a) Traversal
b) Process
c) Reference
d) None of these
Answer:
a) Traversal

Question 26.
…………………. is a process of finding a particular value present in a given set of numbers.
a) Filtering
b) Searching
c) Seeking
d) None of these
Answer:
b) Searching

Question 27.
The ………………. compares each element of the list with the value that has to be searched until all the elements in the array have been traversed and compared.
a) Linear search
b) Sequential search
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 28.
A ……………. is defined as a sequence of characters where each character may be a letter, number, or a symbol.
a) String
b) Character
c) Literal
d) Identifier
Answer:
a) String

Question 29.
In C++, there is no basic data type to represent a …………….
a) String
b) Character
c) Literal
d) float
Answer:
a) String

Question 30.
How much memory required for the following array?
char country[6];
a) 12 bytes
b) 6 bytes
c) 60 Bytes
d) 24 bytes
Answer:
b) 6 bytes

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 31.
…………….. is a way of initializing the character array:
a) char country[6]={T, ‘N’ ‘D’ ‘I’, ‘A’, ‘\0’};
b) char country[ ]=”INDIA”;
c) char country[ ]={T, ‘N’, ‘D’, T, ‘A’ ‘\0’};
d) Either A or B or C
Answer:
d) Either A or B or C

Question 32.
Which is a correct statement from the following?
a) At the end of the string, a null character is automatically added by the compiler.
b) If the size of the array is not explicitly mentioned, the compiler automatically calculates the size of the array based on the number of elements in the list and allocates space accordingly.
c) In the initialization of the string, if all the characters are not initialized, then the rest of the characters will be filled with NULL.
d) All the above
Answer:
d) All the above

Question 33.
In C++,………………. is used to read a line of text including blank spaces.
a) cin.get( )
b) cin
c) put( )
d) None of these
Answer:
a) cin.get( )

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 34.
………………. function can read the characters till it encounters a newline character or a delimiter specified by the user.
a) getline( )
b) put
c) puts( )
d) None of these
Answer:
a) getline( )

Question 35.
…………………. arrays are a collection of similar elements where the elements are stored in a certain number of rows and columns.
a) One dimensional
b) Two dimensional
c) Multidimensional
d) All the above
Answer:
b) Two dimensional

Question 36.
In two dimensional arrays, …………………. size is compulsory.
a) Column
b) Row
c) Both A and B
d) None of these
Answer:
a) Column

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 37.
In two dimensional arrays, …………….. size is optional.
a) Column
b) Row
c) Both A and B
d) None of these
Answer:
b) Row

Question 38.
int A[3][4 j; How many elements are there in the array “A”?
a) 3
b) 4
c) 7
d) 12
Answer:
d) 12

Question 39.
The two-dimensional array uses ………………. index values to access a particular element in it.
a) two
b) one
c) three
d) many
Answer:
a) two

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 40.
In a two dimensional array, the first index specifies the …………….. value.
a) Column
b) Row
c) Both A and B
d) None of these
Answer:
b) Row

Question 41.
In a two dimensional array, the second index specifies the …………… value.
a) Column
b) Row
c) Both A and B
d) None of these
Answer:
a) Column

Question 42.
The two-dimensional array can be viewed as a …………………
a) List
b) Matrix
c) Linear block
d) None of these
Answer:
b) Matrix

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 43.
There are …………… types of 2-D array memory representations.
a) two
b) one
c) three
d) many
Answer:
a) two

Question 44.
……………… is a type of 2-D array memory representation.
a) Row-Major order
b) Column-Major order
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 45.
In row-major order, all the elements are stored ……………… in contiguous memory locations.
a) Column by Column
b) Row by Row
c) Both A and B
d) None of these
Answer:
b) Row by Row

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 46.
In column-major order, all the elements are stored ………………. in contiguous memory locations.
a) Column by Column
b) Row by Row
c) Both A and B
d) None of these
Answer:
a) Column by Column

Question 47.
An array of strings is a ………………. dimensional character array,
a) Two
b) One
c) Multi
d) None of these
Answer:
a) Two

Question 48.
In a two-dimensional character array, the size of the first index (rows) denotes the ……………….
a) Maximum length of each string
b) Number of strings
c) Maximum characters
d) None of these
Answer:
b) Number of strings

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 49.
In a two-dimensional character array, the size of the second index (rows) denotes the ……………….
a) Maximum length of each string
b) Number of strings
c) Maximum characters
d) None of these
Answer:
a) Maximum length of each string

Question 50.
char Name[6][10]; How many strings can be stored in the above array?
a) 10
b) 60
c) 6
d) 16
Answer:
c) 6

Question 51.
To pass an array to a function in C++, the function needs the ………….. as an argument,
a) Array name
b) Array type
c) Dimension
d) None of these
Answer:
a) Array name

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Very Short Answers (2 Marks)

Question 1.
What is the formula to calculate the memory space allocated for an array?
Answer:
A number of bytes allocated for the type of array x Number of elements.

Question 2.
What are the types of arrays?
Answer:
There are different types of arrays used in C++. They are:

  1. One-dimensional arrays
  2. Two-dimensional arrays
  3. Multi-dimensional arrays

Question 3.
Write about returning structures from functions.
Answer:
A structure can be passed to a function through its object. Therefore, passing a structure to a function or passing a structure object to a function is the same because the structure object represents the structure. Like a normal variable, a structure variable(structure object) can be passed by value or by references/addresses. Similar to built-in data types, structures also can be returned from a function.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
Write the syntax and example for one-dimensional declaration and initialization.
Answer:
Syntax:
[size] = {value-1,value-2,………….,value-n};
Example:
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 3

Question 5.
What is a global object?
Answer:
Objects declared along with structure definition are called global objects.

Question 6.
Write a note on strings.
Answer:
strings:
A string is defined as a sequence of characters where each character may be a letter, number or symbol. Each element occupies one byte of memory. Every string is terminated by a null C\0′ ASCII code 0) character which must be appended at the end of the string.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
Differentiate array and structure.
Answer:
Array:

  • An array is a collection of variables of the same data type.
  • Array data are accessed using index.
  • Array allocates static memory
  • Array element access takes lesser time.

Structure:

  • A structure is a collection of variables of different data type.
  • Structure elements are accessed using operator.
  • Structures allocate dynamic memory.
  • Structure elements take more time.

Short Answers (3 Marks)

Question 1.
Write about the initialization of 2 – D array.
Answer:
The array can be initialized in more than one way at the time of 2-D array declaration.
For example
int matrix[4][3] = {
{10,20,30},// Initializes row 0
{40,50,60},// Initializes row 1
{70,80,90},// Initializes row 2
{100,110,120}// Initializes row 3
};
int matrix[4][3] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120};
Array’s row size is optional but column size is compulsory.

Question 2.
What is subscript? Give its rules,
Answer:
subscript:
Each element has a unique index number starting from 0 which is known as a subscript.
Rules for subscript:

  • The subscript always starts with 0.
  • It should be an unsigned integer value.
  • Each element of an array is referred to by its name with a subscript index within the square bracket.

For example:
num[3] refers to the 4th element in the array.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 3.
How memory locations are allocated to a one-dimensional array?
Answer:
Memory representation of a one-dimensional array:
The amount of storage required to hold an array is directly related to type and size.
The following figure shows the memory allocation of an array with five elements.
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 4
The above figure clearly shows that the array num is an integer array with 5 elements. Here, there is a total of 5 elements in the array, where for each element, 4 bytes in Dev C++ (or)2 bytes in Turbo C++ will be allocated. Totally 20 bytes will be allocated for this array (In Turbo C++ 10 Bytes).

Question 4.
Tabulate the memory requirement of data type in Turbo C++ and Dev C++.
Answer:

Data type

Turbo C++

Dev C++

char 1 1
int 2 4
float 4 4
long 4 4
double 8 8
long double 10 10

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 5.
Explain character Array (String) creation with syntax and example.
Answer:
To create any kind of array, the size (length) of the array must be known in advance, so that the memory locations can be allocated according to the size of the array. Once an array is created, its length is fixed and cannot be changed during run time, This is shown in the following figure.
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 5
Syntax of array declaration is:
char array_name[size];
In the above declaration, the size of the array must be an unsigned integer value.

For example,
char country[6];
Here, the array reserves 6 bytes of memory, for storing’ a seqi characters. The length of the string cannot be more than 5 characters and one location is reserved for the null character at the end.

Question 6.
What is an array of strings?
Answer:
An array of strings is a two – dimensional character array. The size of the first index (rows) denotes the number of strings and the size of the second index (columns) denotes the maximum length of each string. Usually, an array of strings are declared in such a way to accommodate the null character at the end of each string. For example, the 2 – D array has the declaration: char Name[6][10];
In the above declaration, the 2 – D array has two indices which refer to the row size and column size, that is 6 refers to the number of rows, and 10 refers to the number of columns.

Question 7.
Write note on getline( ) function.
Answer:
In C++, getline( ) is also used to read a line . of text from the input stream. It can read the characters tilt it encounters a newline character or a delimiter specifier’ by the user. This function is available in the header.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 8.
How memory represented for a 2-D array?
Answer:
There are two types of 2-D array memory representations. They are:

  • Row Major order
  • Column Major order

For example:
int A[4][3]={ { 8,6,5}, { 2,1,9}, {3,6,4}, {4,3,2} };
Row Major order:
In row-major order, all the elements are stored row by row in continuous memory locations, that is, ail the elements in first row, then in the second row and soon. The memory representation of row-major order is as shown below.
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 6

Question 9.
How 2-D character array initialized and stored in memory? Explain.
Answer:
2D char array initialization:

For example:
char Name[6][10] = {“Mr. Bean’; “Mr.Bush”
“Nicole”, “Kidman” “Arnold”, “Jodie”};
In the above’ example, the 2-D array is initialized with 6 strings, where the string is a maximum of 9 characters long since the last character is null. The memory arrangement of a 2-D array is shown below and ail the strings are stored in continuous locations.
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 7

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 10.
What is called nested structure? Give example.
Answer:
The structure declared within another structure is called a nested structure. Nested structures act as members of another structure and the members of the child structure can be accessed as parent structure name. Child structure name. Member name, struct dob
{
int date;
char month[3];
int year;
} ;
Values can be assigned to this structure as follows.
dob = {25, “DEC”, 2017}

Question 11.
Write a program to pass an array as an argument to a function.
Answer:
In C++, arrays can be passed to a function as an argument.
To pass an array to a function in C++, the function needs the array name as an argument.
C++ program-to display marks of 5 students (one-dimensional array)
#indude<iostream>
using namespace std;
void display (int m[5]);
int main( )
{
int marks[5]={88, 76, 90, 61, 69};
display(marks);
return 0;
}
void’ display (int m[5])
{
cout << “\n. Display Marks: ” << end!; for (int i=0; i<5; i++)
{
cout <-< “Student” << i+1 << ” << m[i]<<endl;
}
}
Output
Display Marks:
Student 1: 88
Student 2: 76
Student 3: 90
Student 4: 61
Student 5: 69

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 12.
Write a C++ program to pass a 2-D array to a function.
Answer:
C++ program to display values from two dimensional array:
#include<iostream>
using namespace std;
void display (int n[3][2]);
int main( )
{
int num[3][2] = { {3, 4}, (9, 5}, {7,1} };
display(num);
return 0; ‘
}
void display(int n[3][2])
{
cout << “\n Displaying Values” << endl;
for (int i=0; i<3; i++)
{
for (int j=0; j<2; j++)
{
cout << n[i][j] << ”
}
cout << endl << endl;
}
}
Output
Displaying Values
3 4
9 5
7 1

Question 13.
Write a user-defined function to return the structure after accepting value through the keyboard. The structure definition is as follows: struct Item{int item no; float price;};
Answer:
item accept (item i)
{

cout << “\n Enter the Item No:”; cin >> i.no;
cout << “\n Enter the Item Price:”; cin >> i.price;
return i;

}

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Explain in Detail (5 Marks)

Question 1.
How will you search an element in a one-dimensional array? Explain linear search.
Answer:
Searching in a one-dimensional array:
Searching is a process of finding a particular value present in a given set of numbers. The linear search or sequential search compares each element of the list with the value that has to be searched until all the elements in the array have been traversed and compared.

Program for Linear Search
#include<iostream>
using namespace std;
int Search(int arr[ ], int size, int value)
{
for (int i=0; <size; i++)
{
if (arr[i] == value)
return i; // return index value
}
return -1;
}
int main( )
{
int num[10], val, id;
for (int i=0; i< 10; i++) .
{
cout<<“\n Enter value” << i+1 <<“=”;
cin>>num[i];
}
cout<< “\n Enter a value to be searched: “;
cin>>val;
id=Search(num,10,val);
if(id==-1) .
cout<< “\n Given value is not found in the array..”;
else
cout<< “\n The value is found at the position” << id+1;
return 0;
}
The above program reads an array and prompts for the values to be searched. It calls the Search() function which receives array, size and value to be searched as parameters. If the value is found, then it returns the array index to the called statement; otherwise, it returns -1.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 2.
Explain two-dimensional array with syntax and example.
Answer:
Two-dimensional array:
Two-dimensional (2D) arrays are collections of similar elements where the elements are stored in a certain number of rows and columns. An example m x n matrix where m denotes the number of rows and n denotes the number of columns is shown in the following figure, int arr[3][3];
2D array conceptual memory representation
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 8

The array arr can be conceptually viewed in matrix form with 3 rows and columns. point to be noted here is since the subscript starts with 0 arr [0][0] represents the first element.

The syntax for declaration of a 2-D array is:
data-type array_name[row-size][col-size];
In the above declaration, data-type refers to any valid C++ data-type, array_name refers to the name of the 2-D array, row-size refers to the number of rows and col-size refers to the number of columns in the 2-D array.

For example:
int A[3][4];
In the above example, A is a 2-D array, 3 denotes the number of rows and 4 denotes the number of columns. This array can hold a maximum of 12 elements.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Case Study

Question (1)
Write a program to accept the marks of 10 students and find the average, maximum and minimum marks.
Answer:
PROGRAM
#include<iostream>
using namespace std;
int main( )
{
int marks[10], sum=0,max,min;
float avg;
cout<< “\n Enter Mark 1” << “=”;
cin>> marks[0];
max=marks[0];
min=marks[0];
for(int i=1; i< 10; i++)
{
cout<< “\n Enter Mark” << i+1 << “=”;
cin>> marks[i];
sum=sum+marks[i];
if (marks[i]>max)
max = marks[i];
if (marks[i]<min)
min = marks[i];
}
avg=sum/10.0;
cout<< “\n The Total Marks: ” << sum;
cout<< “\n The Average Mark: ” <<avg;
cout<< “\n The Maximum Mark: ” <<max;
cout<< “\n The Minimum Mark: ” <<min;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 9

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question (2)
Write a program to accept rainfall recorded in four metropolitan cities of India and find the city that has the highest and lowest rainfall.
Answer:
PROGRAM
#include<iostream>
#include<string.h>
using namespace std;
int main( )
{
int rate[10],min,n;
char shop[5][20];
char minshop[20];
cout<<“\nHow many Shops
cin>>n;
for(int i=0;i<n;i++)
{
cout<<“\nEnter Name of the Shop “<<i+1<<” :”;
cin> >shop[i];
cout<<“\nEnter price of Product-X at “<<shop[i]<<” :”;
cin>>rate[i];
}
min=rate[0];
strcpy(minshop,shop[0]);
for(int i=l;i<n;i++)
{
if (rate[i]<min)
{
min = rate[i];
strcpy(minshop,shop[i]);
}
}
cout< < “\n The Lowest cost of the Proudct=X at the” “<<minshop <<“is”<<min;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 10

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question (3)
Survey your neighboring shops and find the price of any particular product of interest and suggest where to buy the product at the lowest cost.
Answer:
PROGRAM
#include<iostream>
#include<string.h>
using namespace std;
int main( )
{
int rate[10],min,n;
char shop[5][20];
char minshop[20];
cout<<“\nHow many Shops “;
cin>>n;
for(int i=0;i<n;i++)
{
cout<<“\nEnter Name of the Shop “<<i+l<<” :”;
cin>>shop[i];
cout<<“\nEnter price of Product-X at “<<shop[i]<<“:”;
cin> >rate[i];
}
min=rate[0];
strcpy(nninshop,shop[0]);
for(int i=l;i<n;i++)
{
if (rate[i]<min)
{
min = rate[i];
strcpy(minshop,shop[i]);
}
}
cout< < “\n The Lowest cost of the Proudct=X at the ” <<minshop <<“is”<<min;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 11

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

STRUCTURES

Book Evaluation

Part -I

Choose The Correct Answer

Question 1.
The data elements in the structure are also known as ……………..
a) objects
b) members
c) data
d) records
Answer:
b) members

Question 2.
Structure definition is terminated by ……………..
a) :
b) }
c) ;
d) ::
Answer:
c) ;

Question 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
Answer:
b) it will allocate the memory

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
What is the out of this program?
#include<iostream>
#include<string.h>
using namespace std;
int main( )
{
struct student
{
int n;
char name[10];
};
students;
s.n = 123;
183
strcpy(s.name, “Balu”);
cout<<s.n;
co
ut<< s.name <<endl;
return 0;
}
a) 123Balu
b) BaluBalu
c) Balul23
d) 123 Balu
Answer:
a) 123Balu

Question 5.
A structure declaration is given below.
struct Time
{
int hours;
int minutes;
int seconds;
}t;
Using the above declaration which of the following refers to seconds.
a) Time.seconds
b) Time::seconds
c) seconds
d) t. seconds
Answer:
d) t. seconds

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 6.
What will be the output of this program?
#include <iostream>
using namespace std;
struct ShoeType
{
string name; double price;
>; , ‘ ‘
int main()
184 {
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

Answer:
a) Adidas # 9.99 Adidas #1.11

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 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;};
Answer:
d) struct sum {int num;};

Question 8.
A structure declaration is given below.
struct employee
{
int empno;
char ename[10];
} e[5];
Using the 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;
Answer:
a) cout<<e[0].empno<<e[0].ename;

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 9.
Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) variable of double datatype
Answer:
b) Function

Question 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
Answer:
a) structure variable

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Part – II

Very Short Answers

Question 1.
Define structure. What is its use?
Answer:
Definition:
The structure is user-defined which has the combination of data items with different data types. This allows to a group of variables of mixed data types together into a single unit.
Use: The structure provides a facility to store different data types as a part of the same logical element in one memory chunk adjacent to each other.

Question 2.
To store 100 integer numbers which of the following is good to use?
Answer:
Array or Structure State the reason.
In any situation when more than one variable is required to represent objects of uniform data types, an array can be used. If the elements are of different data types, then the array cannot support them.
The structure provides a facility to store different data types as a part of the same logical element in one memory chunk adjacent to each other. So, to store 100 integer numbers Array is good.

Question 3.
What is the error in the following structure definition.
Answer:
struct employee {inteno; charename[20]; char dept;}
Employee e1,e2;

Error:
In the above code objects for employee strcture is created at the end of structure definition. So,structure name is not needed. It may written as:
struct employee
{
int eno;
char ename[20];
char dept;
}e1,e2;

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
Write a structure definition for the structure student containing exam no, name and an array for storing five subject marks.
Answer:
Structure definition:
struct student
{
int examno;
char sname[30];
int mark [5];
};

Question 5.
Why for passing a structure to a function call by reference is advisable to us?
Answer:
In call by reference, any change made to the contents of structure variable inside the function are reflected back to the calling function. Otherwise changes in the structure content within the function will not implement in the structure content.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 6.
What is the size of the following highlighted variable in terms of byte if it is compiled in dev C++
Answer:
struct A{ float f[3]; char ch[5];long double d;>;
struct B{ A a; int arr[2][3];}b[3]
struct A {float f[3]; char ch[5]; long double d;>;
Memory requirements (Using Dev C++):

Variable

Memory requirement

float f(3); 12 Bytes
char ch[5];   , 5 Bytes
double d; 8 Bytes

Using Turbo C++ also the same memory is needed. (Only int data type requirement is differ. Here no int members. So, no change in the requirement.)
struct B { A a; int arr[2][3];}b[3];
Memory requirements (Using Dev C++):

Variable

Memory requirement

A a; (Which is a structure variable) 25 Bytes
int arr[2][3]; 24 Bytes
b[3] which is a structure variable of structure B 49 Bytes for each element of b. So, Total requirement of b[3] is 147 Bytes.

Memory requirements (Using Turbo C++):

Variable

Memory requirement

A a; (Which is a structure variable) 25 Bytes
int arr[2][3]; 12 Bytes
b[3] which is a structure variable of structure B 37 Bytes for each element of b. So, Total requirement of b[3] is 111 Bytes.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
Is the following snippet is fully correct. If not identify the error.
Answer:
struct sum1{ int n1,n2;}s1;
struct sum2{int n1,n2}s2;
cin>>s1.n1>>s1.n2;
s2=s1;
No. It is not fully correct. The following errors are there.
Errors:

Statement

Error

struct sum1 {int n1,n2;}sl; No Error
struct sum2 {int n1,n2}s2; Semicolon missing at the end of declaration statement;
cin>>s1.n1>>s1. n2; No Error
s2-s1; Objects of different structures can not be directly copied.

Question 8.
Differentiate array and structure.
Answer:
In any situation when more than one variable is required to represent objects of uniform data¬types, array can be used. If the elements are of different data types, then array cannot support. If more than one variable is used, they can be stored in memory but not in adjacent locations. It increases the time consumption while searching.

The structure provides a facility to store different data types as a part of the same logical element in one memory chunk adjacent to each other.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 9.
What are the different ways to initialize the structure members?
Answer:
Values can be assigned to structure elements similar to assigning values to variables.
Example:
Consider the following structure: struct Student
{
long int rollno;
int age;
float weight;
}
balu ;
We can initialize as given below:
balu.rollno= 702016;
balu. age=18; ‘
balu.weight= 48.5;
Also, values can be assigned directly as similar to assigning values to Arrays.
balu={702016, 18, 48.5};

Question 10.
What is wrong with the following C++ declarations?
Answer:
A. struct point ( double x, y)
B. struct point { double x, double y >;
C. struct point { double x; double y >
D. struct point { double x; double y; };
E. struct point { double x; double y; >

Errors:
A. struct point (double x, y)
Structure definition must be terminated with;. It is missing. Members must be enclosed in { }. So it may be written as
struct point { double x, y };

B. struct point {double x, double y>;
Structure member declaration must be terminated with; It is missing. So, it may corrected as
struct point {double x; double y;>; or struct point {double x, y;>;

C. struct point {double x; double y>
Structure member declaration and definition must be terminated with ; It is missing. So, it may corrected as
struct point {double x; double y;>; or
struct point { double x, y; >;

D. struct point {double x; double y;};,
No error .
E. struct point {double x; double y;>
– Structure definition must be terminated with ; it is missing. So, it may be corrected as
struct point {double x; double y;>;

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Part – III

Short Answers

Question 1.
How will you pass a structure to a function ?
Answer:
A structure variable can be passed to a function in a similar way of passing any argument that is of built-in data type,

  1. If the structure itself is an argument, then it is called “call by value”.
  2. If the reference of the structure is passed as an argument then it is called, “call by reference”.

Call by value
When a structure is passed as argument to a function using call by value method,any change made to the contents of the structure variable inside the function to which it is passed do not affect the structure variable used as an argument.

Call by reference
In this method of passing the structures to functions, the address of a structure variable / object is passed to the function using address of(&) operator. So any change made to the contents of structure variable inside the function are reflected back to the calling function.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 2.
The following code sums up the total of all students name starting with ‘S’ and display it. Fill in the blanks with required statements.
Answer:
struct student {int exam no, lang, eng, phy, che, mat, esc, total; char name[15];>;
int main( )
{
student s[20];
for(int i=0;i<20;i++)
{
…………………. //accept student details
}
for(int i=0;i<20;i++)
{
……………. //check for name starts with’ letter “S”
…………….. // display the detail of the checked name
}
return 0;
}
MODIFIED PROGRAM
using namespace std;
#include<iostream>
struct student
{
int exam_.no,lang,eng,phy,che,mat,esc,total; char name[15];
};
int main( )
{
student s[20];
for(int i=0;i<20;i++)
{
//accept student details
cout<<“\nEnter student name”;
cin>>s[i].name;
cout<<“\nEnter student exam number”;
cin>>s[i].exam_no;
cout<<“\nEnter Languge Mark”;
cin>>s[i].lang;
cout<<“\nEnter Engjish Mark”;
cin>>s[i].eng;
cout<<“\nEnter Physics Mark”;
cin>>s[i].phy;
cout<<“\nEnter Chemistry Mark”;
cin>>s[i].che;
cout<<“\nEnter Maths Mark”;
cin>>s[i].mat;
cout<<“\nEnter Computer Science Mark”;
cin>>s[i].csc;
s[i].total = s[i].lang + s[i].eng + s[i]. phy+s[i].che+s[i].mat+s[i]. csc;
}
cout<<“\nDetails of student name starts with letter S “<<endl;
for(int i=0;i<20;i++)
{
//check for name starts with letter “S” if(s[i].name[0] == ‘S’)
{
// display the detail of the checked name

cout<<“\nName : “<<s[i].
name<<“Total Mark”<<s[i].
total <<endl;
}
}
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 12

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 3.
What is called nested structure. Give example
Answer:
The structure declared- within another structure is called a nested structure.
Example:
struct Student
{
int age;
float height, weight;
struct dob
{
int date;
char month[4];
int year;
};
}mahesh;
The nested structures act as members of another structure and the members of the child structure can be accessed as parent structure name. Child structure name. Member name.
Example:
mahesh. dob. date
Here

  • mahesh is a parent structure name.
  • dob is a child structure name
  • date is a member of child structure

Question 4.
Rewrite the following program after removing the syntactical error(s), if any.
Answer:
Underline each correction.
struct movie
{
charm_name[10];
charm-Lang[10];
float ticket cost =50;};
Movie;
void main( )
{
gets(m_name);
cin>>m-lang;
return 0; ,
}
MODIFIED PROGRAM
PROGRAM (USING DEV C++)
#include<iostream>
#include<conio.h>
#include<stdio.h>
struct movie
{
char m_name[10];
char m_lang[10];
float ticket_cost;
} Movie;
int main( )
{
std::cout<<“\nEnter Move! Name ;
gets(Movie.m_name);
std::cout<<:”\nEnter Movie Language ,:
std: :cin>>Movie.m -lang;
std::cout<<“\nEnter Ticket Cost: “;
std::cin>>Movie.ticket_cost;
std::cout<<“\nMovie name is : “<
std::cout< <“\nMovie Language is : “<<Movie.m-lang;
std::cout<<“\nTicket cost is : “<<Movie.ticket_cost;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 13

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 5.
What ¡s the difference among the following two programs?
a) #include<iostream.h>
struct point
{
double x;
double y;
};
int main()
{
struct point test;
testx = .25; test.y = .75;
cout< <test.x< ctest.y;
return 0;
}
b) #include
struct .
{
double x;
double y;
} Point;
int main(void)
{
Point test={.25,.75>;
return 0;
}
Answer:
The method of structure initialisation is different.

Question 6.
How to access members of a structure? Give f example.
Answer:
Once the two objects of student structure type are declared, their members can be accessed directly. The syntax for that is using a dot (.) between the object name and the member name.
Syntax is :
Object name. Member

For example:
struct Student
{
longrollno;
int age;
float weight;
}balu, frank;
The elements of the structure Student can be accessed as follows: balu.rollno balu.age balu. weight frank, rollno frank.age frank.weight
balu.rollno
balu.age
balu.weight
frank.rollno
frank.age
frank.weight

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
Write the syntax and an example for structure.
Answer:
Structure is declared using the keyword ‘struct’. The syntax of creating a structure is given below.
struct structure_name
{
type member_name1;
type member_name2;
} reference_name;
An optional field reference_name can be used to declare objects of the structure type directly.

Example:
struct Student
{
longrollno;
int age;
float weight;
}balu, frank;

Question 8.
For the following structure, definition writes the user-defined function to accept data through the keyboard.
struct date
{
int dd,mm,yy
};
struct item
{
int item id;
char name[10];
float price;
date date_manif;
}
Answer:
USER DEFINED FUNCTION
item accept( )
{
item obj;
cout<<“\n Enter Item Id “;
cin> > obj. item id;
cout<<“\nEnter Name “;
cin>obj.name;
cout<<“\nEnter Price “;
cin>>obj.price;
cout<<“\nEnter Date: date, month and year
cin>>obj.date_manif.dd >> obj.date_manif. mm >> obj.date_manif.yy;
return(obj);
}

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 9.
What is called an anonymous structure? Give an example.
Answer:
A structure without a name/tag is called anonymous structure, struct
{
long rollno;
int age;
float weight;
} student;
The student can be referred to as a reference name to the above structure and the elements can be accessed like
student, roll no
student.age and
student.weight.

Question 10.
Write a user-defined function to return the structure after accepting value through the keyboard. The structure definition is as follows:
struct Item{int item no;float price;};
Answer:
USER DEFINED FUNCTION
Item accept( )
{
Item obj; ,
cout<<‘AnEnter Item Number and Price “; cin>>obj.item_no>>obj, price.
return(obj);
}

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Part-IV

Explain in Detail

Question 1.
Explain the array of structures with examples.
Answer:
A class may contain many students. So, the definition of structure for one student can also be extended to all the students. If the class has 20 students, then 20 individual structures are required. For this purpose, an array of structures can be used.
An array of structures is declared in the same way as declaring an array with built-in data types like int or char.
The following program reads the details of 20 students and prints the same.
#include<iostream>
using namespace std;
struct Student
{
int age;
float height, weight;
char name[30];
};
void main()
{
Student std[20];
int i;
cout<< ” Enter the details for 20 students”<<endl;
for(i=0;i<20;i++)
{
cout<< ” Enter the details of student”<<i+1<<endl;
cout<< ” Enter the age:”<<endl; cin>>std[i].age;
cout<< “Enter the height:”<<endl; cin>>std[i].height;
cout<< “Enter the weight:”<<endl; cin>>std[i].weight;
}
cout<< “The values entered for Age, height and weight are”<<endl;
for(i=0;i<20;i++)
cout<< “Student “<<i+l<< “\t”< <std[i]. age<< “\t”<<std[i].height<< “\t”<<std[i]. weight;
}
Output
Enter the details of 20 students
Enter the details for student1
Enter the age:
18
Enter the height:
160.5
Enter the weight:
46.5
Enter the details for student2
Enter the age:
18
Enter the height:
164.5
Enter the weight:
61.5
………………………………….
…………………………
The values entered for Age, height and weight are
Student 1 18 160.5 46.5
Student 2 18 164.5 61.5
………………………

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 2.
Explain call by value with respect to structure.
Answer:
A structure variable can be passed to a function in a similar way of passing any argument that is of built-in data type. If the structure itself is an argument, then it is called “call by value”.

Call by value
When a structure is passed as argument to a function using call by value method,any change made to the contents of the structure variable inside the function to which it is passed do not affect the structure variable used as an argument.
Example:
#include<iostream>
using namespace std;
struct Employee
{
char name[50]; ,
int age;
float salary;
};
void printData(Employee); // Function declaration
int main( )
{
Employee p;
cout<< “Enter Full name: “;
cin>>p.name;
cout<< “Enter age: “;
cin>>p.age;
cout<< “Enter salary: “;
cin>>p.salary;
// Function call with structure variable as an argument
printData(p);
return 0;
}
void printData(Employee q)
{
cout<< “\nDisplaying Information.” <<endl;
cout<< “Name: ” << q.name <<endl;
cout<<“Age: ” <<q.age<<endl;
cout<< “Salary:” <<q.salary;
}
Output
Enter Full name: Kumar
Enter age: 55
Enter salary: 34233.4
Displaying Information.
Name: Kumar
Age: 55
Salary: 34233.4
In the above example, a structure named Employee is declared and used. The values that are entered into the structure are name, age and salary of a Employee are displayed using a function named printData( ).

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 3.
How call by reference is used to pass structure to a function .Give an Example
Answer:
Call by reference
In this method of passing the structures to functions ,the address of a structure variable / object is passed to the function using address of(&) operator. So any change made to the contents of structure variable inside the function are reflected back to the calling function
Example:
#include<iostream>
using namespace std;
struct Employee
{
char name[50];
int age;
float salary;
};
void readData(Employee &);
void printData(Employee);
int main()
{
Employee p;
readData(p);
printData(p);
return 0;
}
void readData(Employee &p)
{
cout<< “Enter Full name: “;
cin.get(p.name, 50);
cout<< “Enter age:
cin>>p.age; ,
cout<< “Enter salary:
cin>>p. salary;
}
void printData(Employee p)
{
cout<< “\nDisplaying Information.” <<endl;
cout<< “Name: ” << p.name <<endl;
cout<<“Age:” <<p.age<<endl;
cout<< “Salary:” <<p.salary;
}
Output
Enter Full name: Kumar
Enter age: 55
Enter salary: 34233.4
Displaying Information.
Name: Kumar
Age: 55
Salary: 34233.4
Structures are usually passed by reference method because it saves the memory space and executes faster.

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
Write a C++ program to add two distances using the following structure definition
Answer:
struct Distance
{
int feet;
float inch;
}d1, d2, sum;
PROGRAM
#include<iostream>
using namespace std;
struct Distance
{
int feet;
float inch;
} d1, d2, sum;
int main( )
{
cout<<“\nEnter distance 1: feet and inch : “;
cin>>d1.feet>>d1.inch;
cout<<“\nEnter distance 2: feet and inch :
cin>>d2.feet>>d2.inch;
sum.feet = d1.feet + d2.feet;
sum.inch =(d1.inch + d2.inch) – (int) (d1.inch + d2,inch) / 12 * 12;
sum.feet = sum.feet + (d1.inch + d2.inch)/12;
cout<<“\nDitance 1: Feet = “<<d1.feet<<”
Inch = “<<d1.inch;
cout<<“\nDitance 2: Feet = “<<d2.feet<<”
Inch = “<<d2.inch;
cout<<“\nSum of Distance 1 and 2 : Feet = “<<sum.feet<<” Inch = “<<sum.inch;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 14

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 5.
Write a C++ Program to Add two Complex Numbers by Passing Structure to a Function for the following structure definition
Answer:
struct complex
{
float real;
float imag;
};
The prototype of the function is complex add Complex Numbers(complex, complex);
PROGRAM
#include<iostream>
using namespace std;
struct complex
{
float real;
float imag;
};
complex add Complex Numbers (complex obj1,complex obj2)
{
complex obj3;
obj3.real = obj1.reai+obj2,real;
obj3.imag = obj1.imag + obj2.imag;
return(obj3);
}
int main( )
{
complex c1,c2,c3;
cout<<“\nEnter First complex number real and imaginary :”;
cin>>c1,real>>c1.imag;
cout<<“\nEnter Second complex number real and imaginary :”;
cin>>c2.real>>c2.imag;
c3 = addComplexNumbers(c1,c2);
cout<<“\nFirst Complex Number is : “< }
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 15

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 6.
WrIte a C++ Program to declare a structure book containing name and author as character array of 20 elements each and price as Integer. Declare an array of book. Accept the name, author, price detail for each book. Define a user defined function to display the book details and calculate the total price. Return total price to the calling function.
Answer:
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
#include<istdio.h>
struct book
{
char bname[20],author[20];
int price;
};
int display(book x[5])
{
int total;
for(int i=0;i<5;i++)
{
total = total + x[i].price;
cout<<“\nBook name : “<<x[i].
bname;
cout<<“\nAuthor name : “<<x[i].
author;
cout<<“\nPrice of the book: “<<x[i].
price;
}
return(total);C++C
}
int main( )
{
book. b[5];
for(int i=0;i<5;i++)
{
cout<<“\nEnter Book name “;
cin>>b[i].bname;
cout<<“\nEnter Author name “;
cin>>b[i].author;
cout<<“\nEnter Book Price “;
cin > > b[i]. price;
}
cout<<“\nDetails of Books”<<endl;
cout<<“\nTotal cost of the book is : Rs.”<<display(b);
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 16

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
Write a C++ program to declare and accept an array of professors. Display the details of the department=”COMP.SCI” and the name of the professors start with ‘A’. The structure “college” should contain the following members.
prof-id as integer ,
name and Department as character array
Answer:
PROGRAM
using namespace std;
#include<iostream>
#include<iomanip>
#include<string.h>
struct college .
{
char pname[20],department[20]; int prof-id;
};
void display(college x[5])
{
for(int i=0;i<5;i++)
{
if((strcmp(x[i]. department,”COMP. SCI”)==0) && x[i].pname[0]==’A’)
cout<<x[i].pname«endl;
}
return;
}
int main( )
{
college c[5];
for(int i=0;i <5;i++)
{
cout<<“\nEnter Professor Name “;
cin>>c[i].pname; ,
cout<<“\nEnter Department Name “;
cin> >c[i] .department;
cout< <“\nEnter Professor Id
cin>>c[i].prof-id;
}
cout<<“\nDetails of Comp. Sci. . Dept, Professors whose name starts. with A “<<endl; . display(c);
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 17

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 8.
Write the output of the following C++ program
Answer:
#incluçle<iostream>
#include<stdio>
#include<string>
#include<conio>
using namespace std;
struct books
{
char name[20), author[20];
} a[50];
int main ( )
{
clrscr( );
cout<< “Details of Book No ” << 1 << “\n”;
cout<< “———————\n”;
cout<< ‘Book Name :”<<strcpy(a[0].
name,”Programming “)<<endl;
cout<< “Book Author :”<<strcpy(a[0].
author,”Dromy”)<<endl;
cout<< “\nDetails of Book No ” << 2 <<”\n”;
cout<< ” ——————- \n”;
cout<<- “Book Name :”<<strcpy(a[l].
name,”C++programming” )<<endl;
cout<< “Book Author :”<<strcpy(a[l].
author,”BjarneStroustrup “)< <endl;
cout<<“\n\n”;
cout<< “======================
============================
\n”; ‘
cout<< ” S.No\t| Book Name\t|author\n”;
cout<< “=======================
=============================
for (int i = 0; i < 2; i++)
{
cout<< “\n ” << i + 1 << “\t|” << a[i].name << “\t| ” << a[i],author;
}
cout<< “\n=========-==========
===========================
==”;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 18

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 9.
Write the output of the following C++ program
Answer:
#include<iostream>
#include<string>
using namespace std;
struct student
{
introll_no;
char name[10];
long phone_number;
};
int main() .
{
student p1 = {1,”Brown”,123443};
student p2, p3;
p2.roll_no = 2;
strcpy(p2.name,”Sam”);
p2.phone_number = 1234567822;
p3.roll_no = 3;
strcpy(p3.name,”Addy”);
p3.phone_number = 1234567844;
cout<< “First Student” <<endl;
cout<< “roll no : ” << p1.roll_no <<endl;
cout<< “name : ” << p1.name <<endl;
cout<< “phone no ; ” << p1.phone_number <<endl;
cout<< “Second Student” <<endl;
cout<< “roll no : ” << p2.roll_no <<endl;
cout<< “name : ” << p2.name <<endl;
cout<< “phone no : ” << p2.phone_number <<endl;
cout<< “Third Student” <<endl;
cout<< “roll no : ” << p3.roll_no <<endl;
cout<< “name : ” << p3.name <<endl;
cout<< “phone no : ” << p3.phone_number <<endl;
return0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 19

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 10.
Debug the error in the following program.
Answer:
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 20
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 21
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 22
MODIFIED PROGRAM
#include<iostream.h>
struct PersonRec
{
char lastName[10];
char firstName[10];
int age;
}
Person Rec PeopleArrayType[ 10];
void LoadArray(PeopleRec peop[10]);
void main( )
{
PersonRec people [10];
for (i = 0; i < 10; i++)
{
cout< < people[i].firstName< < ” <<peopie[i].lastName <<setw(10) <<people[i].age;
}
}
LoadArray(PersonRec peop[10])
{
for (int i = 0; i < 10; i++)
{
cout<< “Enter first name: “;
cin<<peop[i].firstName;
cout<< “Enter last name: “;
cin>>peop[i].lastName;
cout<< “Enter age: “;
cin>> peop[i].age;←
}

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

11th Computer Science Guide Arrays and Structures Additional Questions and Answers

Choose The Correct Answer 1 mark

Question 1.
…………….. is a user-defined which has the combination of data items with different data types.
a) Structure
b) Class
c) Union
d) Array
Answer:
a) Structure

Question 2.
…………………. allows to group of variables of mixed data types together into a single unit.
a) Structure
b) Class
c) Union
d) Array
Answer:
a) Structure

Question 3.
If the elements are of different data types,then ……………… cannot support.
a) Structure
b) Class
c) Union
d) Array
Answer:
d) Array

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
Structure is declared using the keyword …………………
a) Structure
b) struct
c) Stru
d) STRUCT
Answer:
b) struct

Question 5.
Identify the structure name from the following; struct Student balu;
a) balu
b) struct
c) Student
d) None of these
Answer:
c) Student

Question 6.
Identify the structure variable (object) from the following: struct Student balu;
a) balu
b) struct
c) Student
d) None of these
Answer:
a) balu

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
How much of memory is required for the object of the following structure in Dev C++.
struct Student
{
long rollno;
int age;
float weight;
}balu, frank;
a) 12 Bytes
b) 8 Bytes
c) 10 Bytes
d) None of these
Answer:
a) 12 Bytes

Question 8.
How much of memory is required for the object of the following structure in Turbo C++.
struct Student
{
long rollno;
int age;
float weight;
}balu, frank;
a) 12 Bytes
b) 8 Bytes
c) 10 Bytes
d) None of these
Answer:
c) 10 Bytes

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 9.
If the members are pointer types then ……………….. is used to access the structure members.
a) →
b) ←
c) .(dot)
d) None of these
Answer:
a) →

Question 10.
A structure without a …………….. is called an anonymous structure.
a) Name
b) Tag
c) Name/Tag
d) None of these
Answer:
c) Name/Tag

Question 11.
…………………… operator is used to accessing structure member.
a) ::
b) @
c) .(dot)
d) $
Answer:
c) .(dot)

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 12.
The structure declared within another structure is called a …………….. structure.
a) Nested
b) Group
c) Block
d) None of these
Answer:
a) Nested

Question 13.
……………. structures act as members of another structure.
a) Nested
b) Group
c) Block
d) None of these
Answer:
a) Nested

Question 14.
The members of the child structure can be accessed as …………………….
a) Child structure name. Parent structure name. Member name
a) Parent structure name. Child structure name. Member name
a) Parent structure name. Member name. Child structure name
a) Member name. Parent structure name. Child structure name
Answer:
a) Child structure name. Parent structure name. Member name

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 15.
A structure variable can be passed to a function in a similar way of passing any argument that is of ……………………. data type.
a) Derived
b) User-defined
c) Built-in
d) None of these
Answer:
c) Built-in

Question 16.
If the structure itself is an argument to a function, then it is called ………………..
a) Call by value
b) Call by Reference
c) Call by Expression
d) None of these
Answer:
a) Call by value

Question 17.
If the reference of the structure is passed as an argument then it is called ……………….
a) Call by value
b) Call by Reference
c) Call by Expression
d) None of these
Answer:
b) Call by Reference

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 18.
When a structure is passed as an argument to a function using ……………… method, any change made to the contents of the structure variable inside the function to which it is passed do not affect the structure variable used as an argument.
a) Call by value
b) Call by Reference
c) Call by Expression
d) None of these
Answer:
a) Call by value

Question 19.
In ……………….method of passing the structures to functions, any change made to the contents of structure variable inside the function are reflected back to the calling function.
a) Call by value
b) Call by Reference
c) Call by Expression
d) None of these
Answer:
b) Call by Reference

Question 20.
Structures are usually passed by reference method because ……………..
a) It saves the memory space
b) Executes faster
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 21.
Identify the correct statement from the following.
a) A structured object can also be assigned to another structure object only if both the objects are of the same structure type.
b) The structure elements can be initialized either by using separate assignment statements or at the time of declaration by surrounding its values with braces.
c) Array of structure variable can also be created.
d) All the above
Answer:
d) All the above

Very Short Answers (2 Marks)

Question 1.
What is the drawback of an array?
Answer:
In any situation when more than one variable is required to represent objects of uniform data-types, array can be used. If the elements are of different data types, then array cannot support.
If more than one variable is used, they can be stored in memory but not in adjacent locations. It increases the time consumption while searching.

Question 2.
What is the advantage of structure?
Answer:
The structure provides a facility to store different data types as a part of the same logical element in one memory chunk adjacent to each other.

Question 3.
What are global objects?
Answer:
Objects declared along with structure definition are called global objects

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 4.
Write note on the anonymous structure.
Answer:
A structure without a name/tag is called an anonymous structure.

Example:
struct
{
long rollno;
int age;
float weight;
} student;
The student can be referred to as a reference name to the above structure and the elements can be accessed like a student, roll no, student.age and student.weight

Question 5.
Define Nested structure.
Answer:
The structure declared within another structure is called a nested structure.

Question 6.
Give an example of nested structure.
Answer:
struct Student
{
int age;
float height, weight;
struct dob
{
int date;
char month[4];
int year;
};
}mahesh;

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 7.
How to access nested member structure?
Answer:
The nested structures act as members of another structure and the members of the child structure can be accessed as
parent structure name. Child structure name. Member name
Example:
mahesh. dob. date

Short Answers 3 Marks

Question 1.
Write the syntax of defining a structure? Give an example.
Answer:
Structure is declared using the keyword ‘struct’. The syntax of creating a structure is given below.
struct structure_name
{
type member-name1;
type member_name2;
} reference_name;
An optional field reference_name can be used to declare objects of the structure type directly.
Example:
struct Student
{
long rollno;
int age;
float weight;
};

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Question 2.
How memory is allocated for a structure?
Answer:
Consider the following structure :
struct Student
{
long rollno;
int age;
float weight;
};
In the above declaration of the struct, three variables rollno, age and weight are used. These variables (data element) within the structure are called members (or fields). In order to use the Student structure, a variable of type Student is declared and the memory allocation is shown in the following figure.
Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures 23

Question 3.
How will you refer structure elements?
Answer:
Referencing Structure Elements
Once the two objects of student structure type are declared, their members can be accessed directly.
The syntax for that is using a dot (.) between the object name and the member name. For example, the elements of the structure Student can be accessed as follows:
balu.rollno
frank, rollno
balu.age
frank.age
balu.weight
frank.weight

Samacheer Kalvi 11th Computer Science Guide Chapter 12 Arrays and Structures

Explain In Detail 5 Marks

Question 1.
Explain structure assignments in detail.
Answer:
Structure Assignments
Structures can be assigned directly instead of assigning the values of elements individually.
Example:
If Mahesh and Praveen are same age and same height and weight then the values of Mahesh can be copied to Praveen struct Student
{
int age;
float height, weight;
}mahesh;
The age of Mahesh is 17 and the height and weights are 164.5 and 52.5 respectively.The following statement will perform the assignment.
mahesh = {17, 164.5, 52.5};
praveen = mahesh;
will assign the same age, height and weight to Praveen.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 11 Functions Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 11 Functions

11th Computer Science Guide Functions Text Book Questions and Answers

Book Evaluation

Part I

Choose The Correct Answer

Question 1.
Which of the following header file defines the standard I/O predefined functions ?
a) stdio.h
b) math.h
c) string.h
d) ctype.h
Answer:
a) stdio.h

Question 2.
Which function is used to check whether a character is alphanumeric or not ?
a) isalpha( )
b) isdigit( )
c) isalnum( )
d) islower( )
Answer:
c) isalnum( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 3.
Which function begins the program execution ?
a) isalpha( )
b) isdigit( )
c) main( )
d) islower( )
Answer:
c) main( )

Question 4.
Which of the following function is with a return value and without any argument ?
a) x=display(int/ int)
b) x=display( )
c) y=display(float)
d) display(int)
Answer:
b) x=display( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
Which is return data type of the function prototype of add (int, int); ?
a) int
b) float
c) char
d) double
Answer:
a) int

Question 6.
Which of the following is the scope operator ?
a) >
b) &
c) %
d) ::
Answer:
d) ::

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Part – II

Very Short Answers

Question 1.
Define Functions.
Answer:
A large program can typically be split into small subprograms (blocks) called functions where each sub-program can perform some specific functionality. Functions reduce the size and complexity of a program, make it easier to understand, test, and check for errors.

Question 2.
Write about strlen() function.
Answer:
The strlen() takes a null-terminated byte string source as its argument and returns its length. The length does not include the null(\0) character.
Example:
char source[ ] = “Computer Science”;
cout<<“\nGiven String is “<<source<<” its Length is “<<strlen(source);
Output
Given String is Computer Science its Length is 16

Question 3.
What are the importance of void data type?
Answer:
void type has two important purposes:

  1. To indicate the function does not return a value.
  2. To declare a generic pointer.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
What is Parameter and list its types?
Answer:
Arguments or parameters are the means to pass values from the calling function to the called function.
Types:

  1. The variables used in the function definition as parameters are known as formal parameters.
  2. The constants, variables, or expressions used j in the function call are known as actual parameters.

Question 5.
Write a note on Local Scope.
Answer:

  1. A local variable is defined within a block. A block of code begins and ends with curly braces { }.
  2. The scope of a local variable is the block in which it is defined.
  3. A local variable cannot be accessed from outside the block of its declaration.
  4. A local variable is created upon entry into its block and destroyed upon exit

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Part – III

Short Answers

Question 1.
What is Built-in functions?
Answer:
The functions which are available by default are known as “Built-in” functions. Ready-to-use subprograms are called pre-defined functions or built-in functions.

Question 2.
What is the difference between isupper() and toupper() functions?
Answer:
isupper():

  • This function is used to check the given character is uppercase.
  • This function will return 1 if true otherwise 0.

toupper():

  • This function is used to convert the given character into its uppercase.
  • This function will return the upper case equivalent of the given character. If the given character itself is in upper case, the output will be the same.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 3.
Write about strcmp( ) function.
Answer:
strcmp( )
The strcmp( ) function takes two arguments: string 1 and string2. It compares the contents of string 1 and string2 lexicographically.
The strcmp() function returns a:

  • Positive value if the first differing character in string 1 is greater than the corresponding character in string2. (ASCII values are compared)
  • Negative value if the first differing character in string 1 is less than the corresponding character in string2,
  • 0 if string1 and string2 are equal.

Example:
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
char string1[ ] = “Computer”;
char string2[ ] = “Science”;
int result;
result = strcmp(string1,string2);
if(result==0)
{
cout<<“String1 : “<<string1<<” and String2 : “<<string2 <<“Are Equal”;
}
else
{
cout<<“String1 :”<<string1<<” and String2 : “<<string2’ <<“ Are Not Equal”;
}
}
Output
String1 : Computer and String2 : Science Are Not Equa1

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Write short note on pow( ) function in C++.
Answer:
pow( ) function:
The pow( ) function returns base raised to the power of exponent. If any argument passed to pow( ) is long double, the return type is promoted to long double. If not, the return type is double.
The pow( ) function takes two arguments:

  • base – the base value
  • exponent – exponent of the base

#include <iostream>
#include <math.h>
using namespace std;
int main ( )
{
double base, exponent, result;
base = 5;
exponent = 4;
result = pow(base, exponent);
cout << “pow(“< double x = 25;;
result = sin(x);
cout << “\nsin(“<<x<<“)= “<<result;
return 0;
}
Output
pow(5^4) = 625
sin(25) = -0.132352

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
What are the information the prototype provides to the compiler?
Answer:
The prototype above provides the following information to the compiler:

  1. The return value of the function is of type long.
  2. Fact is the name of the function.
  3. The function is called with two arguments:
    • The first argument is of int data type.
    • The second argument is of double data type, int display(int, int) // function prototype//.

The above function prototype provides details about the return data type, name of the function and a list of formal parameters or arguments.

Question 6.
What is default arguments ? Give example.
Answer:
default arguments:
In C++, one can assign default values to the formal parameters of a function prototype. The default arguments allows to omit some arguments when calling the function.

When calling a function,
For any missing arguments, complier uses the values in default arguments for the called function.
The default value is given in the form of variable initialization.

Example:
void defaultvalue(int n1=10, n2=100);
The default arguments facilitate the function call statement with partial or no arguments or complete arguments.

Example:
defaultvalue(x,y);
defaultvalue(200,150);
defaultvalue(150);
defaultvalue( );
The default values can be included in the function prototype from right to left, i.e., we cannot have a default value for an argument in between the argument list.

Example:
void defaultvalue(int n1 = 10, n2);//invalid prototype
void defaultvalue(int n1, n2 = 10);//valid prototype

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Part – IV

Explain in Detail

Question 1.
Explain the Call by value method with a suitable example.
Answer:
Call by value method:
This method copies the value of an actual parameter into the formal parameter of the function. In this case, changes made to the formal parameter within the function will have no effect on the actual parameter.

Example:
#include <iostream>
using namespace std;
void display(int x)
{
int a = x * x;
cout<<“\n\nThe Value inside display function
(a * a):”<<a;
}
int main( )
{
int a;
cout<<“\nExample : Function call by value:”;
cout<<“\n\nEnter the Value for A cin>>a;
display(a);
cout<<”\n\nThe Value inside main function “<<a;
return (0);
}
Output:
Example: Function call by value Enter the Value for A : 5
The Value inside display function (a * a) : 25
The Value inside main function 5

Question 2.
What is Recursion? Write a program to find GCD using recursion.
Answer:
A function that calls itself is known as a recursive function. And, this technique is known as recursion.

Finding GCD of any to number using Recursion:
GCD – Greatest Common Divisor or HCF (Highest Common Factor) or GCM – Greatest Common Measure)
#include <iostream>
using namespace std;
//Function to find HCF or GCD OR GCM // int gcd(int n1, int n2)
{
if (n2 != 0)
return gcd(n2, n1 % n2); //Recursive call of gcd function
else
return n1;
}
int main( )
{
int num1, num2;
cout << “Enter two positive integers: “;
cin >> num1 >> num2;
cout << “Greatest Common Divisor (GCD) of ” << num1;
cout<< ” & ” << num2 << ” is: ” << gcd(num1, num2);
return 0;
}
Output :
Enter two positive integers: 350 100
Greatest Common Divisor (GCD) of 350 & 100 is: 50

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 3.
What are the different forms of function return? Explain with example.
Answer:
Different forms of User-defined Function declarations:
Function without return value and without parameter
The following program is an example of a function with no return and no arguments passed.
The name of the function is display( ), its return data type is void and it does not have any argument.
#include <iostream>
using namespace std;
void display( )
{
cout<<“Function without parameter and return value”;
}
int main()
{
display( ); // Function calling statement//
return(O);
}
Output :
Function without parameter and return value
A Function with return value and without parameter
The name of the function is display(), its return type is int and it does not have any argument. The return statement returns a value to the calling function and transfers the program control back to the calling statement.

#include <iostream>
using namespace std;
int display( )
{
int a, b, s;
cout<<“Enter 2 numbers:
cin>>a>>b;
s=a+b;
return s;
}
int main( )
{
int m=display( );
cout<<“\nThe Sum=”<<m;
return(0);
}
OUTPUT :
Enter 2 numbers: 10 30
The Sum = 40

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Explain scope of variable with an example.
Answer:
Scope refers to the accessibility of a variable.
There are four types of scopes in C++

  1. Local Scope
  2. Function Scope
  3. File Scope
  4. Class Scope

1. Local Scope:

  • A local variable is defined within a block. A block of code begins and ends with curly braces {}.
  • The scope of a local variable is the block in which it is defined.
  • A local variable cannot be accessed from outside the block of its declaration.
  • A local variable is created upon entry into its block and destroyed upon exit;

Example:
int main( )
{
int a,b;   //Local variable
}

2. Function Scope:

  • The scope of a variable within a function is extended to the function block and all sub-blocks therein.
  • The lifetime of a function scope variable is the lifetime of the function block.

Example:
int. sum(int x, int y);  //x and y has function scope.

3. File Scope:

  • A variable declared above all blocks and functions (including main()) has the scope of a file.
  • The lifetime of a file scope variable is the lifetime of a program.
  • The file scope variable is also called a global variable.

Example:
#include
using namespace std;
int x,y; //x and y are global variable
void main()
{
……..
}

4. Class Scope:

  • Data members declared in a class has the class scope.
  • Data members declared in a class can be accessed by all member functions of the class.

Example:
Class example
{
int x,y; //x and y can be accessed by print() and void():
void print();
Void total();
};

Class Scope:
A class is a new way of creating and implementing a user-defined data type. Classes provide a method for packing together data of different types.
Data members are the data variables that represent the features or properties of a class.

class student
}
private:
int mark1, mark2, total;
};
The class student contains mark1, mark2, and total are data variables. Its scope is within the class of students only.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
Write a program to accept any integer number and reverse it.
Answer:
PROGRAM:
using namespace std;
#include <iostream>
int reverse(int num)
{
int r=0,d;
while(num>0)
{
d = num%10;
r = r*10+d;
num = num/10;
}
return (r);
}
int main( )
{
intx;
cout<<“\nEnter a number”;
cin>>x;
cout<<“\nReverse of the number is “<<reverse(x);
return 0;
}
OUTPUT
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 1

11th Computer Science Guide Functions Additional Questions and Answers

Choose The Correct Answer 1 Mark

Question 1.
………………. is the name of the function.
(a) Predefined
(b) Built-in
(c) Library
(d) All the above
Answer:
(d) All the above

Question 2.
…………….. reduce the size and complexity of a program, makes it easier to understand, test, and check for errors.
a) Arrays
b) Functions
c) Structures
d) Unions
Answer:
b) Functions

Question 3.
The strcpy() function takes two arguments of ……………….
(a) target and source
(b) upper and lower
(c) base and exponent
(d) none of these
Answer:
(a) target and source

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Functions which are available in the C++ language standard library is known as ……………… functions.
a) Built-in
b) User-defined
c) Either A or B
d) None of these
Answer:
a) Built-in

Question 5.
The pow() function takes the two arguments of ……………….
(a) target and source
(b) upper and lower
(c) base and exponent
(d) source and exponent
Answer:
(c) base and exponent

Question 6.
Why functions are needed?
a) Divide and conquer the purpose
b) Reusability of code
c) Reduce the complexity of a program
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 7.
The C++ program always has a main() function to begin the program execution.
(a) 1
(b) 2
(c) 3
(d) null
Answer:
(a) 1

Question 8.
Ready-to-use subprograms are called ………………..
a) Pre-defined functions
b) Built-in functions
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 9.
In C++ the arguments can be passed to a function in ………………. ways.
(a) 2
(b) 1
(c) 3
(d) 7
Answer:
(a) 2

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 10.
A header file can be identified by their file extension ……………..
a) .head
b) .h
c) .hf
d) None of these
Answer:
b) .h

Question 11.
…………… is a header file contains pre-defined standard input/output functions.
a) conio.h
b) istream.h
c) iostream.h
d) stdio.h
Answer:
d) stdio.h

Question 12.
stdio.h header file defines the standard I/O predefined function ……………
a) getchar()
b) putchar()
c) getsQ and puts()
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 13.
The predefined function ……………. is used to get a single character from the keyboard.
a) getchar()
b) putchar()
c) gets() and puts()
d) puts()
Answer:
a) getchar()

Question 14.
The predefined function …………… is used to display a single character.
a) getchar( )
b) putchar( )
c) gets( )
d) puts( )
Answer:
b) putchar( )

Question 15.
Function ……………… reads a string from standard input and stores it into the string pointed by the variable.
a) getchar( )
b) putchar( )
c) gets( )
d) puts( )
Answer:
c) gets( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 16.
Function …………….. prints the string read by gets() function in a newline.
a) getchar( )
b) putchar( )
c) gets( )
d) puts( )
Answer:
d) puts( )

Question 17.
……………. header file defines various operations on characters.
a) conio.h
b) ctype.h
c) iostream.h
d) stdio.h
Answer:
b) ctype.h

Question 18.
……………… function is used to check whether a character is alphanumeric or not.
a) isalnum( )
b) isalpha( )
c) isdigit( )
d) None of these
Answer:
a) isalnum( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 19.
………….. function returns a non-zero value if the given character is a digit or a letter, else it returns 0.
a) isalnum( )
b) isaipha( )
c) isdigit( )
d) None of these
Answer:
a) isalnum( )

Question 20.
The ……………… function is used to check whether the given character is an alphabet or not.
a) isalnum( )
b) isalpha( )
c) isdigit( )
d) None of these
Answer:
b) isalpha( )

Question 21.
………….. function will return 1 if the given character is an alphabet, and 0 otherwise 0.
a) isalnum( )
b) isalpha( )
c) isdigit( )
d) None of these
Answer:
b) isalpha( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 22.
………… function is used to check whether a given character is a digit or not.
a) isalnum( )
b) isalpha( )
c) isdigit( )
d) None of these
Answer:
c) isdigit( )

Question 23.
……………. function will return 1 if the given character is a digit, and 0 otherwise.
a) isalnum( )
b) isalpha( )
c) isdigit( )
d) None of these
Answer:
c) isdigit( )

Question 24.
………………. function is used to check whether a character is in lower case (small letter) or not.
a) islower( )
b) tolower( )
c) Both A and B
d) None of these
Answer:
a) islower( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 25.
……………. functions will return a non-zero value if the given character is a lower case alphabet, and 0 otherwise.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
a) islower( )

Question 26.
……………. function is used to check the given character is uppercase.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
d) isupper( )

Question 27.
……………. function will return 1 if the given character is an uppercase alphabet otherwise 0.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
d) isupper( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 28.
…………. function is used to convert the given character into its uppercase.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
c) toupper( )

Question 29.
………….. function will return the upper case equivalent of the given character.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
c) toupper( )

Question 30.
………………… function is used to convert the given character into its lowercase.
a) islower( )
b) tolower( )
c) toupper( )
d) isupper( )
Answer:
b) tolower( )

Question 31.
………………. function copies the character string pointed by the source to the memory location pointed by the target.
a) strcpy( )
b) strcat( )
c) strcmp( )
d) strlen( )
Answer:
a) strcpy( )

Question 32.
The …………………. function takes a null-terminated byte string source as its argument and returns its length.
a) strcpy( )
b) strcat( )
c) strcmp( )
d) strlen( )
Answer:
d) strlen( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 33.
The length of the string does not include the _______ character.
a) Null(\0)
b) Blank space
c) White space
d) None of these
Answer:
a) Null(\0)

Question 34.
………………. function compares the contents of string1 and string2 lexicographically.
a) strcpy( )
b) strcat( )
c) strcmp( )
d) strlen( )
Answer:
c) strcmp()

Question 35.
The Strcmp( ) function returns a ………………. value if the first differing character in string1 is greater than the corresponding character in string2.
a) Positive
b) Negative
c) Zero
d) None of these
Answer:
a) Positive

Question 36.
The Strcmp() function returns a …………….. value if the first differing character in stringl is less than the corresponding character in string2.
a) Positive
b) Negative
c) Zero
d) None of these
Answer:
b) Negative

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 37.
………………. function appends copy of the character string pointed by the source to the end of string pointed by the target.
a) strcpy( )
b) strcat( )
c) strcmp( )
d) strlen( )
Answer:
b) strcat( )

Question 38.
The …………….. function is used to convert the given string into Uppercase letters.
a) strupr( )
b) toupper( )
c) Both A and B
d) None of these
Answer:
a) strupr( )

Question 39.
The …………….. function is used to convert the given string into Lowercase letters.
a) tolower( )
b) strlwr( )
c) Both A and B
d) None of these
Answer:
b) strlwr( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 40.
The cos( ) function takes a single argument in ………………
a) Radians
b) Degree
c) Either A or B
d) None of these
Answer:
a) Radians

Question 41.
The cos( ) function returns the value in the range of ……………
a) [0, 1]
b) [-1, 1]
c) [1,-1]
d) None of these
Answer:
b) [-1, 1]

Question 42.
The cos( ) function returns the value in ……………….
a) double
b) float
c) long double
d) Either A or B or C
Answer:
d) Either A or B or C

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 43.
The sqrt( ) function takes a …………… argument.
a) single non-negative
b) single negative
c) double non-negative
d) double negative
Answer:
a) single non-negative

Question 44.
If a negative value is passed as an argument to sqrt( ) function, a …………….. occurs,
a) Data type mismatch
b) Domain error
c) Prototype mismatch
d) None of these
Answer:
b) Domain error

Question 45.
The ………….. function returns, the value in the range of [-1,1].
a) cos( )
b) sin( )
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 46.
The …………….. function returns base raised to the power of the exponent.
a) exponent( )
b) power( )
c) pow( )
d) None of these
Answer:
c) pow( )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 47.
If any argument passed to pow() is long double, the return type is promoted to ……………..
a) long double
b) int
c) double
d) char
Answer:
a) long double

Question 48.
The pow( ) function takes ……………… argument.
a) base
b) exponent
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 49.
The …………….. function in C++ seeds the pseudo-random number generator used by the rand() function.
a) srand( )
b) sran( )
c) rands( )
d) None of these
Answer:
a) srand( )

Question 50.
The srand( ) function is defined in ……………. header file.
a)
b) <stdlib)h>
c) or<stalib)h>
d) None of these
Answer:
c) or<stalib)h>

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 51.
C++ program can contain ……………. main”() function.
a) Only one
b) No
c) More than one
d) None of these
Answer:
a) Only one

Question 52.
In C++,……………… function begins the program execution.
a) void
b) main( )
c) User-defined
d) Built-in
Answer:
b) main( )

Question 53.
………………. data type is used to indicate the function does not return a value.
a) int
b) double
c) void
d) unsigned
Answer:
c) void

Question 54.
……………… data type is used to declare a generic pointer.
a) int
b) double
c) void
d) unsigned
Answer:
c) void

Question 55.
The user-defined function should be called explicitly using its ………………
a) Name
b) Arguments to be passed
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 56.
Which of the following calling the function have a return value and with arguments?
a) display( );
b) display(x,y);
c) x = display( );
d) x = display(x,y);
Answer:
d) x = display(x,y);

Question 57.
Which of the following calling function have no return value and no argument?
a) display( );
b) display(x,y);
c) x = display();
d) x = display(x,y);
Answer:
a) display( );

Question 58.
Which of the following calling the function have no return value and with arguments?
a) display( );
b) display(x,y);
c) x = display();
d) x = display(x,y);
Answer:
b) display(x,y);

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 59.
Which of the following calling the function have a return value and no argument?
a) display();
b) display(x,y);
c) x = display();
d) x = display(x,y);
Answer:
c) x = display();

Question 60.
…………………. are the means to pass values from the calling function to the called function.
a) Arguments
b) Parameters
c) Arguments or Parameters
d) None of these
Answer:
c) Arguments or Parameters

Question 61.
The variables used in the function definition as parameters are known as ……………. parameters.
a) Formal
b) Actual
c) Ideal
d) None of these
Answer:
a) Formal

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 62.
The parameters used in the function call are known as ………………. parameters.
a) Formal
b) Actual
c) Ideal
d) None of these
Answer:
b) Actual

Question 63.
The ……………… can be used in the function call as parameters.
a) Constants
b) Variables
c) Expressions
d) All the above
Answer:
d) All the above

Question 64.
The …………….. arguments allow omitting some arguments when calling the function.
a) Default
b) Actual
c) Formal
d) None of these
Answer:
a) Default

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 65.
The default value is given in the form of …………………….
a) Variable declaration
b) Variable initialization
c) void
d) None of these
Answer:
b) Variable initialization

Question 66.
The default arguments facilitate the function call statement with ………………. arguments.
a) Partial
b) No
c) Complete
d) All the above
Answer:
d) All the above

Question 67.
The default values can be included in the function prototype from ……………….
a) Left to Right
b) Right to Left
c) Center to Left
d) None of these
Answer:
b) Right to Left

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 68.
The constant variable can be declared using the…………… keyword.
a) constant
b) Const
c) const
d) CONST
Answer:
c) const

Question 69.
The …………….. keyword makes variable value stable.
a) constant
b) Const
c) const
d) CONST
Answer:
c) const

Question 70.
The ……………… modifier enables to assign an initial value to a variable that cannot be changed later inside the body of the function,
a) void
b) Const
c) const
d) Unsinged
Answer:
c) const

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 71.
In C++, the arguments can be passed to a function in ……………. ways.
a) three
b) two
c) four
d) None of these
Answer:
b) two

Question 72.
In C++, the arguments can be passed to a function in ……………… method.
a) Call by value
b) Call by reference
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 73.
………………. method copies the value of an actual parameter into the formal parameter of the function.
a) Call by value
b) Call by reference
c) Either A or B
d) None of these
Answer:
a) Call by value

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 74.
In ……………. method, changes made to the formal parameter within the function will have no effect on the actual parameter.
a) Call by value
b) Call by reference
c) Either A or B
d) None of these
Answer:
a) Call by value

Question 75.
………… method copies the address of the actual argument into the formal parameter.
a) Call by value
b) Call by reference
c) Either A or B
d) None of these
Answer:
b) Call by reference

Question 76.
In the…………….. method, any change made in the formal parameter will be reflected back in the actual parameter.
a) Call by value
b) Call by reference
c) Either A or B
d) None of these
Answer:
b) Call by reference

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 77.
The definition of the functions is stored in …………….
a) Array
b) Call by reference
c) Structures
d) None of these
Answer:
b) Call by reference

Question 78.
………….. functions can be used to reduce the overheads like STACKS for small function definition.
a) Inline
b) Built-in
c) User-defined
d) None of these
Answer:
a) Inline

Question 79.
……………. reduces the speed of program execution.
a) Array
b) Stacks
c) Structures
d) Unions
Answer:
b) Stacks

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 80.
A(n) ………….. function looks like a normal function in the source file but inserts the function’s code directly into the calling program.
a) inline
b) Built-in
c) User-defined
d) None of these
Answer:
a) inline

Question 81.
To make a function inline, one has to insert the keyword …………….. in the function header.
a) Inline
b) Insert
c) INLINE
d) None of these
Answer:
a) Inline

Question 82.
……………. functions execute faster but require more memory space.
a) User-defined
b) Built-in
c) Inline
d) None of these
Answer:
c) Inline

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 83.
The inline function reduces the complexity of using …………………
a) Array
b) Stacks
c) Structures
d) Unions
Answer:
b) Stacks

Question 84.
Returning from the function is done by using the ……………… statement.
a) return
b) goto
c) break
d) continue
Answer:
a) return

Question 85.
The …………….. statement stops execution and returns to the calling function.
a) return
b) goto
c) break
d) continue
Answer:
a) return

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 86.
Identify the true statement from the following.
a) A return may or may not have a value associated with it.
b) If the return has a value associated with it, that value becomes the return value for the calling statement.
c) The return statement is used to return from a function.
d) AN the above
Answer:
d) AN the above

Question 87.
The functions that return no value are declared as ……………..
a) Null
b) void
c) Empty
d) None of these
Answer:
b) void

Question 88.
The data type of a function is treated as …………….. if no data type is explicitly mentioned.
a) Null
b) void
c) Empty
d) int
Answer:
d) int

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 89.
What is the return type of the following function prototype? add (int, int);
a) Null
b) void
c) Empty
d) int
Answer:
d) int

Question 90.
What is the return type of the following function prototype? double add (int, int);
a) float
b) void
c) double
d) int
Answer:
c) double

Question 91.
What is the return type of the following function prototype?
char *display();
a) float
b) string
c) double
d) char
Answer:
b) string

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 92.
A function that calls itself is known as ………….. function.
a) recursive
b) nested
c) invariant
d) variant
Answer:
a) recursive

Question 93.
A function that calls itself using …………. technique.
a) recursive
b) variant
c) invariant
d) recursion
Answer:
d) recursion

Question 94.
………………. is mandatory when a function is defined after the main() function.
a) Function prototype
b) Function parameters
c) Return statement
d) None of these
Answer:
a) Function prototype

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 95.
Scope refers to the accessibility of a ……………..
a) Function
b) Class
c) Variable
d) Constant
Answer:
c) Variable

Question 96.
There are ………… types of scopes in C++.
a) five
b) two
c) three
d) four
Answer:
d) four

Question 97.
…………….. is a type of variable scope.
a) Local
b) Function / File
d) Class
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 98.
A …………… is a region or life of the variable and broadly speaking there are three places, where variables can be declared.
a) Scope
b) Access specifier
c) Location
d) None of these
Answer:
a) Scope

Question 99.
Variables inside a block are called …………… variables.
a) Local
b) Function
c) Class
d) File
Answer:
a) Local

Question 100.
Variables inside a function are called ………….. variables.
a) Local
b) Function
c) Class
d) File
Answer:
b) Function

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 101.
Variables outside of ail functions are called ………….. variables.
a) Local
b) Function
c) Class
d) Global
Answer:
d) Global

Question 102.
Variables inside a class are called ……………
a) Class variable
b) Data members
c) Member functions
d) Either A or B
Answer:
d) Either A or B

Question 103.
The scope of formal parameters is …………… scope.
a) Local
b) Function
c) Class
d) File
Answer:
b) Function

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 104.
A variable declared above all blocks and functions (including main ()) has the …………… scope.
a) Local
b) Function
c) Class
d) File
Answer:
d) File

Question 105.
The lifetime of a ………….. scope variable is the lifetime of a program.
a) Local
b) Function
c) Class
d) File
Answer:
d) File

Question 106.
The file scope variable is also called as ………….. variable.
a) Global
b) General
c) Void
d) None of these
Answer:
a) Global

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 107.
…………… provides a method for packing together data of different types.
a) Enumeration
b) Array
c) Class
d) All the above
Answer:
c) Class

Question 108.
……………… represent the features or properties of a class.
a) Member function
b) Data member
c) Global variable
d) None of these
Answer:
b) Data member

Question 109.
…………….. is a scope resolution operator.
a) ? :
b) #
c) : :
d) &&
Answer:
c) : :

Question 110.
The …………… operator reveals the hidden scope of a variable.
a) ? :
b) &&
c) : :
d) #
Answer:
c) : :

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Very Short Answers (2 Marks)

Question 1.
Write about reusability.
Answer:

  1. Few lines of code may be repeatedly used in different contexts. Duplication of the same code can be eliminated by using functions which improve the maintenance and reduce program size.
  2. Some functions can be called multiple times with different inputs.

Question 2.
Why functions are needed?
Answer:
To reduce the size and complexity of the program functions are used.

Question 3.
What are constant arguments and write their syntax?
Answer:
The constant variable can be declared using the const keyword. The const keyword makes variable, value stable. The constant variable should be initialized while declaring. The const modifier enables the assignment of an initial value to a variable that cannot be changed later inside the body of the function.
Syntax: (const )

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Write a note on the reusability of the code.
Answer:
Reusability:

  • Few lines of code may be repeatedly used in different contexts. Duplication of the same code can be eliminated by using functions which improve the maintenance and reduce program size.
  • Some functions can be called multiple times with different inputs.

Question 5.
What is function scope?
Answer:
Function Scope:

  1. The scope of variables declared within a function is extended to the function block and all sub-blocks therein.
  2. The lifetime of a function scope variable is the lifetime of the function block. The scope of.

Question 6.
What is the header file?
Answer:
C++ provides a rich collection of functions ready to be used for various tasks. The tasks to be performed by each of these are already written, debugged, and compiled, their definitions alone are grouped and stored in files called header files

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 7.
What is a built-in function?
Answer:
The ready-to-use subprograms are called pre-defined functions or built-in functions.

Question 8.
What is a user-defined function?
Answer:
C++ provides the facility to create new functions for specific tasks as per user requirements. The name of the task and data required is decided by the user and hence they are known as User-defined functions.

Question 9.
How a header file is identified?
Answer:
A header file can be identified by their file extension .h.
Example:
stdio.h

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 10.
Write note on stdio.h header file.
Answer:
This header file defines the standard I/O predefined functions getchar(), putchar(), gets(), puts() and etc.

Question 11.
What is the purpose of getchar() and putchar() functions?
Answer:
The predefined function getchar() is used to get a single character from the keyboard and putchar() function is used to display it.

Question 12.
What is the purpose of gets() and puts() functions?
Answer:
Function gets( ) reads a string including balance spaces from standard input and stores it into the string pointed by the variable. Function puts() prints the string read by gets() function in a newline.

Question 13.
Write note on isalpha( ) function.
Answer:
The isalpha( ) function is used to check whether the given character is an alphabet or not.
Syntax:
int isalpha(char c);
This function will return 1 if the given character is an alphabet, and 0 otherwise 0. The following statement assigns 0 to the variable n, since the given character is not an alphabet.
int n = isalphaC3′);
The statement is given below displays 1, since the given character is an alphabet.
cout << isalpha(‘a’); .

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 14.
Write the use of isdigit() function.
Answer:
This function is used to check whether a given character is a digit or not. This function will return 1 if the given character is a digit, and 0 otherwise.
Syntax:
int isdigit(char c);
When the following code is executed, the value of the variable n will be 1, since the given character is a digit.
char ch = ‘3’;
n = isdigit (ch);

Question 15.
How to copy a string into another string?
Answer:
The srcpy() function copies the character string pointed by the source to the memory location pointed by the target. The strcpy() function takes two arguments: target and source. The null terminating character (\0) is also copied.
Example:
char source[ ] = “Computer Science”;
char target[20]=”target”;
strcpy(target,source);

Question 16.
What is the purpose of strupr( ) and strlwr( ) functions?
Answer:

  • The strupr( ) function is used to convert the given string into Uppercase letters.
  • The strlwr( ) function is used to convert the given string into Lowercase letters.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 17.
What is the use of return statement in a function?
Answer:
Returning from the function is done by using the return statement.
The return statement stops execution and returns to the calling function. When a return statement is executed, the function is terminated immediately at that point.

Question 18.
Write note on scope resolution operator.
Answer:
The scope operator reveals the hidden scope ‘ of a variable. The scope resolution operator (::) is used for the following purposes.

To access a Global variable when there is a Local variable with same name. An example using Scope Resolution Operator.
PROGRAM :
#include <iostream>
using namespace std;
int x=45; // Global Variable x
int main()
{
int x = 10; // Local Variable x
cout << “\nValue of global x is ” << ::x;
cout << “\nValue of local x is ” << x;
return 0;
}
Output :
Value of global x is 45
Value of local x is 10

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Short Answers (3 Marks)

Question 1.
What is divide and conquer?
Answer:
Divide and Conquer:

  1. Complicated programs can be divided into manageable sub-programs called functions.
  2. A programmer can focus on developing, debugging, and testing individual functions.
  3. Many programmers can work on different functions simultaneously.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 2.
Write about islower( ) function.
Answer:
islower( )
This function is used to check whether a character is in lower case (small letter) or not.
This function will return a non-zero value, if the given character is a lower case alphabet, and 0 otherwise.
Syntax:
int islower(char c);

After executing the following statements, the value of the variable n will be 1 since the given character is in lower case
char ch = ‘n’;
int n = islower(ch);

The statement given below will assign 0 to the variable n, since the given character is an uppercase alphabet.
int n = islower(‘P’);

Question 3.
What is digit()? Give example.
Answer:
This function is used to check whether a given character is a digit or not. This function will return 1 if the given character is a digit, and 0 otherwise.

Example:
using namespace std;
#include
#include int main( )
{

char ch;
cout << “\n Enter a Character:”; cin >> ch;
cout << “\n The Return Value of isdigit(ch) is << isdigit(ch);

}
Output – 1
Enter a Character: 3
The Return Value of isdigit(ch) is: 1

Output – 2
Enter a Character: A
The Return Value of isdigit(ch) is: 0

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Explain the method of comparing two strings.
Answer:
strcmp( ) function compares the contents of string 1 and string2 lexicographically. The strcmp() function takes two arguments: stringl and string2.

The strcmp( ) function returns a:

  • Positive value if the first differing character in stringl is greater than the corresponding character in string2. (ASCII values are compared)
  • Negative value if the first differing character in stringl is less than the corresponding character in string2.
  • 0 if stringl and string2 are equal.

Example:
#include <string.h>
#inciude <iostream>
using namespace std;
int main()
{
char string1[ ] = “Computer”;
char string2[ ] = “Science”;
int result;
result = strcmp(string1,string2);
if(result==0)
{
cout<<“String1: “<<string1<<“and String2 : “<<string2 <<“Are Equal”;
}
else
{
cout<<“String1 :”<<string1<<” and String2 : “c<<string2<<” Are Not Equal”;
}
}
Output
String1 : Computer and String2 : Science Are Not Equal

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
What is a return statement with an example?
Answer:
The return statement stops execution and returns to the calling function. When a return statement is executed, the function is terminated immediately at that point. The return statement is used to return from a function. It is categorized as a jump statement because it terminates the execution of the function and transfers the control to the called statement.

Example:
return(a + b); return(a);
return; // to terminate the function

Question 6.
Write note on sin() and cos() functions.
Answer:
cos() function
The cos() function takes a single argument in radians. The cosQ function returns the value in the range of [-1, 1], The returned value is either in double, float, or long double.
Example:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x = 0.5, result;
result = cos(x);
cout << “COS(“<<x<<“)= “<<result;
}
Output
COS(0.5)= 0.877583
sin( ) function:
The sin() function takes a single argument in radians. The sin( ) function returns the value in the range of [-1, 1]. The returned value is either in double, float, or long double.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 7.
Write about sqrt( ) and pow( ) functions.
Answer:
sqrt( ) function:
The sqrt( ) function returns the square root of the given value of the argument. The sqrt( ) function takes a single non-negative argument. If a negative value is passed as an argument to sqrt( ) function, a domain error occurs.
Example:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x = 625, result;
result = sqrt(x);
cout << “sqrt(“<<x<<“) = “<<result;
return 0;
}
Output
sqrt(625) = 25
pow( ) function:
The pow( ) function returns base raised to the power of exponent. If any argument passed to pow() is long double, the return type is promoted to long double. If not, the return type is double.
The pow() function takes two arguments:
base – the base value
exponent – exponent of the base Example:
#include <iostream>
#include <math.h>
using namespace std;
int main ( )
{
double base, exponent, result;
base = 5;
exponent = 4;
result = pow(base, exponent);
cout << “pow(“< << “) = ” << result;
double x = 25;;
result = sin(x);
cout << “\nsin(“<<x<<“)= “<<result;
return 0;
}
Output
pow(5 ^ 4) = 625 sin(25)= -0.132352

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 8.
How will you generate a random numbers?
Answer:
The srand( ) function in C++ seeds the pseudo random number generator used by the rand( ) function. The seed for rand( ) function is 1 by default. It means that if no srand( ) is called before rand(), the rand() function behaves as if it was seeded with srand(1).
The srand( ) function takes an unsigned integer as its parameter which is used as seed by the rand() function. It is defined inor <stdlib,h>header file.
Example:
#include <iostream>
#include <cstdlib.h>
using namespace std;
int main()
{
int random = rand(); /* No srand() calls before rand(), so seed = 1 */
cout << “\nSeed = 1, Random number = ” << random;
srand(10);
/* Seed = 10 */
random = rand( );
cout << “\n\nSeed = 10, Random number=” << random;
return 0;
}
Output
Seed = 1, Random number = 41
Seed =10, Random number =71

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 9.
Write note on function prototype.
Answer:
Function Prototype:
C++ program can contain any number of functions. But, it must always have only one main( ) function to begin the program execution. We can write the definitions of functions in any order as we wish.

We can define the main( ) function first and all other functions after that or we can define all the needed functions prior to main( ). Like a variable declaration, a function must be declared before it is used in the program.
The declaration statement may be given outside the main( ) function.

Example:
long fact (int, double);
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 2

Question 10.
Explain Formal Parameters and Actual Parameters or Arguments.
Answer:
Formal Parameters and Actual Parameters or Arguments:
Arguments or parameters are the means to pass values from the calling function to the called function.

  • The variables used in the function definition as parameters are known as formal parameters.
  • The constants, variables or expressions used in the function call are known as actual parameters.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 3

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Explain in Detail (5 Marks)

Question 1.
Explain about generating random numbers with a suitable program.
Answer:
The srand() function in C++ seeds the pseudo-random number generator used by the rand() function. The seed for rand() function is 1 by default. It means that if no srand() is called before rand(), the rand() function behaves as if it was seeded with srand( 1). The srand() function takes an unsigned integer as its parameter which is used as seed by the rand() function. It is defined inor header file.
#include
#include using namespace std; int main()
{

int random = rand(); /* No srand() calls before rand(), so seed = 1*/
cout << “\nSeed = 1, Random number =” << random;
srand(10);
/* Seed= 10 */
random = rand();
cout << “\n\n Seed =10, Random number =” << random;
return 0;

}
Output:
Seed = 1, Random number = 41
Seed =10, Random number 71

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 2.
How will access function? Explain in detail.
Answer:
Accessing a function:
The user-defined function should be called explicitly using its name and the required arguments to be passed. The compiler refers to the function prototype to check whether the function has been called correctly.

If the argument type does not match exactly with the data type defined in the prototype, the compiler will perform type conversion, if possible. If type conversion is impossible, the compiler generates an error message.
Example :

1. display( ) calling the function without a return value and without any argument.
2. display (x, y) calling the function without a return value and with arguments.
3. x = display() calling the function with a return value and without any argument.
4. x = display (x, y) calling the function with a return value and with arguments.

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 3.
Explain constant argument in detail.
Answer:
Constant Arguments:
The constant variable can be declared using const keyword. The const keyword makes variable value stable. The constant variable should be initialized while declaring. The const modifier enables to assign an initial value to a variable that cannot be changed later inside the body of the function.
Syntax:
<returntype> <functionname> (const <datatype variable=value>)

Example:
int minimum(const int a=10);
float area(const float pi=3.14, int r=5);

PROGRAM
#include <iostream>
using namespace std; ,
double area(const double r,const double pi=3.14)
{
return(pi*r*r);
}
int main ( )
{
double rad,res;
cout<<‘AnEnter Radius :”;
cin>>rad;
res=area(rad);
cout << “\nThe Area of Circle =”<<res;
return 0;
}
OUTPUT:
Enter Radius: 5
The Area of Circle =78.5
If the variable value “r” is changed as r=25;
inside the body of the function “area” then compiler will throw an error as “assignment of
read-only parameter ‘r’ “.
double area (const double r, const double pi= 3.14)
{
r=25;
return(pi*r*r);
}

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Explain about address method.
Answer:
This method copies the address of the actual argument into the formal parameter. Since the address of the argument is passed, any change made in the formal parameter will be reflected back in the actual parameter.
#include
using namespace std;
void display(int & x) //passing address of a//
{

x = x*x;
cout << “\n\n The Value inside display function (n1 x n1) :”<< x ;

}
int main()
{
intn 1;
cout << “\n Enter the Value for N1 cin >> n1;
cout << “\n The Value of N1 is inside main function Before passing:” << n1;
display(n1);
cout << “\n The Value of N1 is inside main function After passing (n1 x n1):”<< n1; retum(O);
}

Output:
Enter the Value for N1: 45
The Value of N1 is inside the main function Before passing: 45
The Value inside display function (n1 x n1) : 2025
The Value ofNl is inside the main function After passing (n1 x n1): 2025

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
Explain inline function in detial.
Answer:
Inline function:
An inline function looks like normal function in the source file but inserts the function’s code directly into the calling program. To make a function inline, one has to insert the keyword inline in the function header.

This reduces the speed of program execution. Inline functions can be used to reduce the overheads like STACKS for small function definition.
Syntax:
inline return type function name (data type parametername1,… datatype parameternameN)
Advantages of inline functions:

  • Inline functions execute faster but requires more memory space.
  • Reduce the complexity of using STACKS.

PROGRAM
#include <iostream>
using namespace std;
inline float simpleinterest (float pi, float nl, float r1)
{
float si1=(p1*n1*r1)/100;
return(si1);
}
int main ( )
{
float si,p,n,r;
cout<<“\nEnter the Principle Amount Rs. :”;
cin> >p;
cout<<“\nEnter the Number of Years:”;
cin>>n;
cout<<“\nEnter the Rate of Interest :”;
cin>>r;
si=simpleinterest(p,n,r);
cout << “\nThe Simple Interest = Rs,”<<si;
return 0;
}
Output:
Enter the Principle Amount Rs. :60000
Enter the Number of Years :10
Enter the Rate of Interest :5
The Simple Interest = Rs.30000
Though the above program is written in the normal function definition format during compilation the function code (p1*n1*r1)/100 will be directly inserted in the calling statement i.e. si=simpleinterest(p,n,r);
This makes the calling statement to change as si= (p1*n1*r1)/100;

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Hands-On Practice

Write C++ program to solve the following problems:
Question 1.
Program that reads two strings and appends the first string to the second. For example, If the first string Is entered as Tamil and the second string is Nadu, the program should print Tamilnadu. Use string library header.
Answer:
PROGRAM :
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
char firststr[50],secondstr[50];
cout<<“\nEnter First String “; cin> >firststr;
cout<<“\nEnter Second String”; cin>>secondstr;
strcat(firststr,secondstr); //concatenation process
cout << ”\nConcatenated string is : ” <<firststr;
return 0;
}
Output:
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 4

Question 2.
Program that reads a string and converts it to uppercase. Include required header files.
Answer:
PROGRAM :
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
char str[50];
cout<<“\nEnter a String
cin>>str;
cout << “\nGvien string is : “<<str; strupr(str);
cout << “\nGvien string in Uppercase is :”<<str;
return 0;
}
Output :
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 5

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 3.
Program that checks whether a given character is an alphabet or not. If It is an alphabet, whether It Is lowercase character or uppercase- character? Include required header files.
Answer:
PROGRAM :
#include <string.h>
#include <iostream>
using namespace std;
int main( )
{
char ch;
cout<<“\nEnter a Character”;
cin>>ch;
if(isalpha(ch))
if(islower(ch))
cout << “\nGiven Character is an Alphabet and in Lowercase”;
else
cout << “\nGiven Character is an Alphabet and in Uppercase “;
else
cout << “\nGiven Character in not an Alphabet”;
return 0;
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 6

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 4.
Program that checks whether the given character is alphanumeric or a digit Add appropriate header file
Answer:
PROGRAM :
#include <string.h>
#include <iostream>
using namespace std;
int main()
{
char ch;
cout<<“\nEnter a Character”;
cin>>ch;
if(isalnum(ch))
if(isdigit(ch))
cout << “\nGiven Character is an Alphanumeric and digit”;
else
cout << “\nGiven Character is an Alphanumeric but not digit”;
else
cout << “\nGiven Character in not an Alphanumeric or digit”;
return 0;
}
Output:
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 7

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 5.
Write a function called zero_small ( ) that has two integer arguments being passed by reference and sets smaller of the two numbers to 0. Write the main program to access this function.
Answer:
PROGRAM
using namespace std;
#include <iostream>
void zero_small(int &a, int &b)
{
if (a<b)
a= 0;
else
b=0;
}
int main( )
{
int num1,num2;
cout<<“\nEnter two numbers :”; cin>>num1>>num2;
cout<<“\nNumber before set small value as 0 through function : num1=” <<num1<<” num2=”<<num2;
zero_small(num1,num2);
cout<<“\nNumber after set small value as 0 through function : num1=” <<num1<<” num2=”<<num2;
}
Output :
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 8
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 9

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 6.
Write definition for a function sumseries ( ) in C++ with two arguments/ parameters – double x and int n. The function should return a value of type double and it should perform sum of the following series:
x-x2 /3! + x3 / 5! – x4 / 7! + x5 / 9! upto n terms.
Answer:
PROGRAM :
using namespace std;
#indude
double sumseries(double x, int n)
{
double sum=0,t;
int f=1,sign=1;
t=x;
inti=1‘,j=1;
while(i<=n)
{
sum = sum + sign * t/f;
j=j + 2;
i++;
f = f*j*(j-1);
t = t * x;
sign = -sign;
}
return(sum);
}
int main()
{
int i,x,n,f=1,sign=1;
cout<<“\nEnter X value …”;
cin>>x;
cout<<“\nEnter N value …”;
cin>>n;
cout<<“\nSUM OF THE SERIES = “<<sumseries(x,n);
return 0;
}
Output :
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 10

Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions

Question 7.
Program that Invokes a function calc ( ) which intakes two integers and an arithmetic operator and prints the corresponding result.
Answer:
PROGRAM :
using namespace std;
#include
void calc(int numl,int num2,char op)
{
int result;
switch(op)
{
case’+’:
result = num1 + num2;
cout<<“\nAdded value “<<result;
break;
case’-‘:
result = num1 – num2;
cout<<“\nSubtracted value “<< result;
break;
case’*’:
result = num1 * num2;
cout<<“\Multiplied value”<<result;
break;
case ‘/’:
result = num1 / num2;
cout<<“\nDivided value “<<result;
break;
default:cout<<“\nPROCESS COMPLETED”;
}
}
int main()
{
float n1,n2;
char op;
cout<<“\nl. Enter two numbers”; cin>>n1>>n2;
cout<<“\nEnter an Operaotr + or – or * Or / :”; cin>>op;
calc(nl,n2,op);
}
Output :
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 11
Samacheer Kalvi 11th Computer Science Guide Chapter 11 Functions 12

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 10 Flow of Control Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 10 Flow of Control

11th Computer Science Guide Flow of Control Text Book Questions and Answers

Book Evaluation

Part I

Choose The Correct Answer

Question 1.
What is the alternate name of null statement?
a) No statement
b) Empty statement
c) Void statement
d) Zero statement
Answer:
b) Empty statement

Question 2.
In C++, the group of statements should enclosed within:
a) { }
b) [ ]
c)()
d)<>
Answer:
a) { }

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 3.
The set of statements that are executed again and again in iteration is called as:
a) condition
b) loop
c) statement
d) body of loop
Answer:
d) body of loop

Question 4.
The multi way branching statement:
a) if
b) if… else
c) switch
d) for
Answer:
c) switch

Question 5.
How many types of iteration statements?
a) 2
b) 3
c) 4
d) 5
Answer:
b) 3

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 6.
How many times the following loop will execute?
for (int i=0; i<10; i++)
a) 0
b) 10
c) 9
d) 11
Answer:
b) 10

Question 7.
Which of the following is the exit control loop?
a) for
b) while
c) do…while
d) if…else
Answer:
c) do…while

Question 8.
Identify the odd one from the keywords of jump statements:
a) break
b) switch
c) go to
d) continue
Answer:
b) switch

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 9.
Which of the following is the exit control loop?
a) do-while
b) for
c) while
d) if-else
Answer:
a) do-while

Question 10.
A loop that contains another loop inside its body:
a) Nested loop
b) Inner loop
c) In line loop
d) Nesting of loop
Answer:
a) Nested loop

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Part – II

Short Answers

Question 1.
What is a null statement and compound statement?
Answer:
null statement; The “null or empty statement” is a statement containing only a semicolon. It takes the flowing form: ;
// it is a null statement
compound Statement:
In C++, a group of statements enclosed by pair of braces {} is called as a compound statement or a block.
The general format of compound statement is:
{
statement1;
statement2;
statement3;
}

Question 2.
What is a selection statement? Write its types?
Answer:
The selection statement means the statements are executed depends upon a condition. If a condition is true, a true block (a set of statements) is executed, otherwise, a false block is executed. This statement is also called a decision statement or selection statement because it helps in making a decision about which set of statements are to be executed.
Types:

  1. Two-way branching
  2. Multiway branching

Question 3.
Correct the following code segment:
Answer:
if (x=1)
p= 100;
else
P = 10;
Correct code: (Equal to operator is wrongly given)
if (x==1)
p= 100;
else
p = 10;

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 4.
What will be the output of the following code:
int year;
cin >> year;
if (year % 100 == 0)
if (year % 400 == 0)
cout << “Leap”;
else
cout << “Not Leap year”;

If the input is given is
(i) 2000
(ii) 2003
(iii) 2010
Answer:
i) 2000 AS INPUT
Output
Leap
ii) 2003AS INPUT
Output
Not Leap year
iii) 2010 AS INPUT
Output
Not Leap year

Question 5.
What is the output of the following code?
for (int i=2; i<=10 ; i+=2)
cout << i;
Answer:
Output
2 4 6 8 10

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 6.
Write a for loop that displays the number from 21 to 30.
Answer:
# include
using namespace std;
int main()
{
for (int = 21; i < 31; i++)
cout << “value of i:” << i << endl;
return 0;
}
Output:
Value of i: 21
Value of i: 22
Value of i: 23
Value of i: 24
Value of i: 25
Value of i: 26
Value of i: 27
Value of i: 28
Value of i: 29
Value of i: 30

Question 7.
Write a while loop that displays numbers 2,4, 6, 8…….20.
Answer:
While loop to
i = 2;
while(i<=20)
{
cout<< i <<“,”;
i = i+2;
}

Question 8.
Compare an if and a ? : operator.
Answer:
The if statement evaluates a condition, if the condition is true then a true-block is executed, otherwise false-block will be executed! Block may consists of one or more statements. The conditional operator (or Ternary operator) . is an alternative for ‘if else statement’. Here if the condition is true one statement otherwise another statement will be executed.

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Part – III

Short Answers

Question 1.
Convert the following if-else to a single conditional statement:
Answer:
if (x >= 10)
a = m + 5;
else
a = m;
a = (x >= 10)? m + 5 : m ;

Question 2.
Rewrite the following code so that it is functional:
Answer:
v = 5;
do;
{
total += v;
cout << total;
while v <=10
CORRECT CODE:
int v = 5;
do
{
total += v;
v++;
} while (v <= 10); cout << total;

Question 3.
Write a C++ program to print the multiplication table of a given number.
Answer:

# include
using namespace std;
int main ()
{

int num;
cout << “Enter Number to find its multiplication table”; cin >> num;
for (int a = 1; a < = 10; a++)
{
cout << num << “*” << a << “=” << num*a << endl;
}
return( );
}

Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 1

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 4.
Write the syntax and purpose of switch statement.
Answer:
The syntax of the switch statement is:
switch(expression)
{
case constant 1:
statement(s);
break;
case constant 2:
statement(s);
break;
.
.
.
.
default:
statement(s);
}
Purpose of switch statement:
The switch statement is a multi-way branch statement. It provides an easy way to dispatch execution to different parts of code based on the value of the expression.

Question 5.
Write a short program to print following series: a) 1 4 7 10…… 40
Answer:
PROGRAM
using namespace std;
#inciude
int main()
{
for(int i=1;i<=40;i=i+3)
cout<<i<<” “;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 2

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Part – IV

Explain In Detail

Question 1.
Explain the control statement with a suitable example.
Answer:
Control statements are statements that alter the sequence of flow of instructions.
In a program, statements may be executed sequentially, selectively, or iteratively. Every programming language provides statements to support sequence, selection (branching), and iteration.
Selection statement:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 3
The selection statement means the statement(s) are executed depends upon a condition. If a condition is true, a true block ¡s executed otherwise a false block is executed. This statement is also called a decision statement or selection statement because it helps in making decisions about which set of statements are to be executed.
Iteration statement:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 4
The iteration statement is a set of the statement are repetitively executed depends upon conditions. If a condition evaluates to true, the set of statements (true block) is executed again and again. As soon as the condition becomes false, the repetition stops. This is also known as a looping statement or iteration statement.

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 2.
What entry control loop? Explain any one of the entry control loops with a suitable example.
Answer:
In an entry-controlled loop, the test- expression is evaluated before entering into a loop, while and for statements are called as entry controlled loop.
Working of while loop:
A while loop is a control flow statement that allows the loop statements to be executed as long as the condition is true. The while loop ¡s an entry-controlled loop because the test-expression is evaluated before the entering into a loop.
The while loop syntax is:
while (Test expression )
{
Body of the loop;
}
Statement-x;
In a while loop, the test expression is evaluated and if the test expression result is true, then the body of the loop is executed and again the control is transferred to the while loop. When the test expression result is false the control is transferred to statement-x.
The control flow and flow chart of the while loop is shown below.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 5
Example:
#include <iostream>
using namespace std;
int main ()
{
int i=1,sum=0;
while(i<=10)
{
sum=sum+i;
i++;
}
cout<<“The sum of 1 to 10 is “<<sum; return 0;
}
Output
The sum of 1 to 10 is 55

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 3.
Write a program to find the LCM and GCD of two numbers.
Answer:
PROGRAM:
using namespace std;
#include <iostream>
int main()
{
int n1, n2, i, gcd;
cout<<“Enter two integers:”;
cin>>n1>>n2;
for(i=1; i <= n1 && i <= n2; ++i)
{
// Checks if i is factor of both integers
if(n1%i==0 && n2%i==0)
gcd = i;
}
int lcm = n1*n2 /gcd;
cout<<“\nG.C.M.OF”<<nl<<“and”<<n2<<”
is”<<gcd;
cout< < “\nL.C. M. OF “< < n 1 < < ” and ” < < n2< < ” is “<<lcm; return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 6
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 7

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 4.
Write programs to find the sum of the following series:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 8
Answer:
PROGRAM
using namespace std;
#include
int main()
{
int i,x,n,f=1,sign=1;
float sum=0,t;
cout<<“\nEnter N value”;
cin>>n;
cout<<“\nEnter x value …”;
cin>>x;
t=x;
for(i=1;i<=n;i++)
{
f = f * i;
sum = sum + sign * t/f;
t = t * x;
sign = -sign;
}
cout<<”SUM OF THE SERIES = “<<sum;
return O;
}
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 9
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 10
PROGRAM
using namespace std;
#include
int main()
{
int i,x,n;
float sum=0,t;
cout<<“\nEnter N value”;
cin>>n;
cout<<“\nEnter x value …”;
cin>>x;
t=x;
for(i=l;i<=n;i++)
{
sum = sum + t/i;
t = t * x;
}
cout<<“SUM OF THE SERIES = “<<sum;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 11

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 5.
Write a program to find sum of the series s=1 +x +x2 + ……..+xn
Answer:
PROGRAM
using namespace std;
#include
int main()
{
int sum=1,x,i,t,n;
cout<<“\nEnter N value”;
cin>>n;
cout<<“\nEnter x value … “;
cin>>x;
t=x;
for(i=l;i<=n;i++)
{
sum = sum + t;
t = t * x;
}
cout<<“SUM = “<<sum;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 12

11th Computer Science Guide Flow of Control Additional Questions and Answers

Choose The Correct Answer 1 Mark

Question 1.
The empty statement is otherwise called as ………………..
(a) Control statement
(b) Zero statement
(c) Null statement
(d) Block statement
Answer:
(c) Null statement

Question 2.
The basics of control structure are……………. statement.
a) Selection
b) Iteration
c) Jump
d) All the above
Answer:
d) All the above

Question 3.
Iteration statement is called as ………………..
(a) Null statement
(b) Block statement
(c) Selection statement
(d) Looping statement
Answer:
(d) Looping statement

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 4.
In a program, the action may be ……………..
a) Variable declarations
b) Expression evaluations
c) Assignment operations
d) All the above
Answer:
d) All the above

Question 5.
……………….. is a multi-path decision-making statement.
(a) if
(b) if-else
(c) else – if
(d) if-else ladder
Answer:
(d) if-else ladder

Question 6.
The ……………. is a statement containing only a semicolon.
a) Null
b) Empty statement
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 7.
……………….. is more efficient than the if-else statement.
(a) Control statement
(b) Switch statement
(c) Empty statement
(d) Null statement
Answer:
(b) Switch statement

Question 8.
C++ allows a group of statements enclosed by pair of ……………..braces.
a) ()
b) { }
c) [ ]
d) < >
Answer:
b) { }

Question 9.
C++ supports types of iteration statements.
(a) 3
(b) 2
(c) 4
(d) 5
Answer:
(a) 3

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 10.
……………. statements alter the sequence of flow of instructions.
a) Control
b) Null
c) Compound
d) None of these
Answer:
a) Control

Question 11.
……………….. is used to transfer the control from one place to another place without any condition in a program.
(a) Break statement
(b) Continue statement
(c) goto statement
(d) All the above
Answer:
(c) goto statement

Question 12.
The ……………. statement are the statements, that are executed one after another only once from top to bottom.
a) Sequential
b) Selective
c) Iterative
d) None of these
Answer:
a) Sequential

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 13.
…………….. statements do not alter the flow of execution.
a) Sequential
b) Selective
c) Iterative
d) None of these
Answer:
a) Sequential

Question 14.
…………….. statements always end with a semicolon (;).
a) Sequential
b) Selective
c) Iterative
d) None of these
Answer:
a) Sequential

Question 15.
The ……………. statement means the statement (s) are executed depends upon a condition.
a) Sequential
b) Selective
c) Iterative
d) None of these
Answer:
b) Selective

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 16.
If a condition is true, a true block (a set of statements) is executed otherwise a false block is executed is called …………… statement.
a) Decision
b) Selection
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 17.
The ……………. statement is a set of the statement are repetitively executed depends upon conditions.
a) Sequential
b) Selective
c) Iterative
d) None of these
Answer:
c) Iterative

Question 18.
The condition on which the execution or exit from the loop is called ………………
a) Exit-condition
b) Test-condition
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 19.
In C++, any non-zero is treated as …………… including negative numbers
a) False
b) True
c) Complement
d) None of these
Answer:
b) True

Question 20.
In C++, zero is treated as …………..
a) False
b) True
c) Complement
d) None of these
Answer:
a) False

Question 21.
Decisions in C++ are made using …………….. statement.
a) if..else
b) switch., case
c) Either A or B
d) None of these
Answer:
c) Either A or B

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 22.
……………. statement which chooses between two alternatives.
a) if..else
b) switch., case
c) Either A or B
d) None of these
Answer:
a) if..else

Question 23.
………………. creates branches for multiple alternatives sections of code, depending on the value of a single variable.
a) if..else
b) switch., case
c) Either A or B
d) None of these
Answer:
b) switch., case

Question 24.
…………. is a two-way branching statement.
a) if..else
b) switch., case
c) Either A or B
d) None of these
Answer:
a) if..else

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 25.
……………….. is a multiple branching statement.
a) if..else
b) switch., case
c) Either A or B
d) None of these
Answer:
b) switch., case

Question 26.
An if statement contains another if the statement is called …………….
a) Nested if
b) Compound if
c) Block if
d) Group if
Answer:
a) Nested if

Question 27.
The nested if can have ……………. forms.
a) four
b) two
c) three
d) five
Answer:
c) three

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 28.
……………. is nested if form.
a) If nested inside if part
b) If nested inside both if part and else part
c) If nested inside else part
d) All the above
Answer:
d) All the above

Question 29.
The ………….. is a multi-path decision-making statement.
a) if-else ladder
b) Simple if
c) if… else
d) None of these
Answer:
a) if-else ladder

Question 30.
In ……………..type of statement ‘if’ is followed by one or more else if statements and finally end with an else statement.
a) if-else ladder
b) Simple if
c) if… else
d) None of these
Answer:
a) if-else ladder

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 31.
The……………. operator is an alternative for the if-else statement.
a) Conditional
b) Ternary
c) Continue
d) Either A or B
Answer:
d) Either A or B

Question 32.
The conditional operator consists of …………….. symbols.
a) two
b) three
c) four
d) five
Answer:
a) two

Question 33.
The conditional operator takes …………….. arguments.
a) two
b) three
c) four
d) five
Answer:
b) three

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 34.
The switch statement is a …………… statement.
a) Multi-way branch
b) Two-way branch
c) Jump
d) None of these
Answer:
a) Multi-way branch

Question 35.
………….. statement provides an easy way to dispatch execution to different parts of code based on the value of the expression.
a) if..else
b) switch
c) goto
d) None of these
Answer:
b) switch

Question 36.
The ………………statement replaces multiple if-else sequences.
a) if..else
b) switch
c) go to
d) None of these
Answer:
b) switch

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 37.
The expression provided in the switch should result in a…………… value.
a) Constant
b) Variant
c) Null
d) None of these
Answer:
a) Constant

Question 38.
In switch statement …………… statement is optional.
a) default
b) break
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 39.
The …………… statement is used inside the switch to terminate a statement sequence.
a) default
b) break
c) continue
d) None of these
Answer:
b) break

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 40.
In a switch statement, when a ………….. statement is reached, the flow of control jumps to the next line following the switch statement.
a) go to
b) break
c) continue
d) None of these
Answer:
b) break

Question 41.
……………. statement checks only for equality.
a) go to
b) if,.else
c) continue
d) switch
Answer:
d) switch

Question 42.
………….. statement checks for equality as well as for logical expression.
a) go to
b) if..else
c) continue
d) switch
Answer:
b) if..else

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 43.
………….. statement uses a single expression for multiple choices.
a) go to
b) if..else
c) continue
d) switch
Answer:
d) switch

Question 44.
A(n) ………….. statement uses multiple statements for multiple choices.
a) go to
b) if..else
c) continue
d) switch
Answer:
b) if..else

Question 45.
The ……………. statement evaluates integer, character, pointer or floating-point type or Boolean type.
a) go to
b) if..else
c) continue
d) switch
Answer:
b) if..else

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 46.
……….. statement evaluates only character or an integer data type.
a) go to
b) if..else
c) continue
d) switch
Answer:
d) switch

Question 47.
If the expression inside the switch statement turns out to be false then statements are executed.
a) default
b) break
c) else block
d) None of these
Answer:
a) default

Question 48.
If the expression inside if turns out to be false, statement inside ………….. will be executed.
a) default
b) true block
c) else block
d) None of these
Answer:
c) else block

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 49.
The ………….. statement is more flexible.
a) switch
b) if
c) continue
d) None of these
Answer:
b) if

Question 50.
The …………… statement is more efficient than the if-else statement.
a) switch
b) go to
c) continue
d) None of these
Answer:
a) switch

Question 51.
Which is true related to the switch statement?
a) A switch statement can only work for the quality of comparisons.
b) No two case labels in the same switch can have identical values.
c) If character constants are used in the switch statement, they are automatically converted to their equivalent ASCII codes.
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 52.
When a switch is a part of the statement sequence of another switch, then it is called as …………….. switch statement.
a) Iterative
b) Sequential
c) Nested
d) None of these
Answer:
c) Nested

Question 53.
A(n) ………….. is a sequence of one or more statements that are repeatedly executed until a condition is satisfied.
a) Iteration
b) Looping
c) Iteration or Looping
d) None of these
Answer:
c) Iteration or Looping

Question 54.
………….. is used to reduce the length of code, to reduce time, to execute the program and takes less memory space.
a) Iteration
b) Looping
c) Iteration or Looping
d) None of these
Answer:
c) Iteration or Looping

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 55.
C++supports ………….. types of iteration statements.
a) five
b) four
c) three
d) two
Answer:
c) three

Question 56.
C++ supports ………….. type of iteration statement.
a) for
b) while
c) do..while
d) All the above
Answer:
d) All the above

Question 57.
Every loop has …………….. elements.
a) five
b) four
c) three
d) two
Answer:
b) four

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 58.
Every loop has ………….. element.
a) Initialization expression
b) Test expression / Update expression
c) The body of the loop
d) All the above
Answer:
d) All the above

Question 59.
The control variable(s) must be initialized …………. the control enters into a loop.
a) after
b) before
c) Either A or B
d) None of these
Answer:
b) before

Question 60.
Whose value decides whether the loop-body will be executed or not?
a) Test expression
b) Update expression
c) Initialization expression
d) None of these
Answer:
a) Test expression

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 61.
In an ……….. loop, the test-expression is evaluated before entering into a loop,
a) Entry-controlled
b) Exit-controlled
c) Both A and B
d) None of these
Answer:
a) Entry-controlled

Question 62.
In an ………….. loop, the test-expression is evaluated before exiting from the loop.
a) Entry-controlled
b) Exit-controlled
c) Both A and B
d) None of these
Answer:
b) Exit-controlled

Question 63.
……………. is used to change the value of the loop variable.
a) Test expression
b) Update expression
c) Initialization expression
d) None of these
Answer:
b) Update expression

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 64.
……………. statement is executed at the end of the loop after the body of the loop is executed.
a) Test expression
b) Update expression
c) Initialization expression
d) None of these
Answer:
b) Update expression

Question 65.
In an …………. loop, first, the test expression is evaluated and if it is nonzero, the body of the loop is executed otherwise the loop is terminated.
a) Entry-controlled
b) Exit-controlled
c) Both A and B
d) None of these
Answer:
a) Entry-controlled

Question 66.
In an …………. loop, the body of the loop is executed first then the test-expression is evaluated.
a) Entry-controlled
b) Exit-controlled
c) Both A and B
d) None of these
Answer:
b) Exit-controlled

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 67.
………….. loop statement contains three different statements.
a) for
b) while
c) do..while
d) All the above
Answer:
a) for

Question 68.
The for statement contains ……………. statement
a) Test expression
b) Update expression
c) Initialization expression
d) All the above
Answer:
d) All the above

Question 69.
The for statement sections are separated by ………………
a) Semicolons
b) Colon
c) Comma
d) None of these
Answer:
a) Semicolons

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 70.
The initialization part of the loop is used to initialize variables or declare a variable which is executed …………… time(s).
a) Loop repeated
b) Only one
c) two
d) None of these
Answer:
b) Only one

Question 71.
How many times the following loop will be executed?
for (i=0; i <= 10; i++);
a) 10
b) 9
c) 11
c) None of these
Answer:
c) 11

Question 72.
If the body of the loop contains a ……………. statement(s), need not use curly braces.
a) Single
b) More than one
c) Either A or B
d) None of these
Answer:
a) Single

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 73.
In for loop, multiple initializations and multiple update expressions are separated by ……………
a) Semicolons
b) Colons
c) Commas
d) None of these
Answer:
c) Commas

Question 74.
In a for loop, which expression is optional?
a) Test expression
b) Update expression
c) Initialization expression
d) All the above
Answer:
d) All the above

Question 75.
What will be formed if the following loop is executed?
for( i=0; ++i);
a) Finite loop
b) Indefinite loop
c) No iteration
d) None of these
Answer:
b) Indefinite loop

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 76.
A loop that has no statement in its body is called an ……………
a) Empty loop
b) Indefinite loop
c) Finite loop
d) None of these
Answer:
a) Empty loop

Question 77.
Identify the empty loop from the following.
a) for( i+0 ; i<=5; +=i);
b) for( i+0 ; i<=5; +=i); {cout<<“C++”;>
c) for( i+0 ; i<=5; +=i) { }
d) All the above
Answer:
d) All the above

Question 78.
A ………….. loop is useful for pausing the program for some time.
a) Time delay
b) Infinite loop
c) Finite loop
d) None of these
Answer:
a) Time delay

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 79.
……………. is a time delay loop.
a) for(i=l; i<=100; i++);
b) int i=l;
while( ++i < 10)
{
}
c) int i=l;
do
{
} while( ++i < 10);
d) All the above
Answer:
d) All the above

Question 80.
How many times the following loop will be executed?
int i=l;
while( ++i < 10)
cout<< “The value of i is “<<i;
a) 10
b) 9
c) 8
d) Infinite times
Answer:
c) 8

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 81.
How many times the following loop will be executed?
int i=l;
while( i++< 10)
cout<< “The value of i is “<<i;
a) 10
b) 9
c) 8
d) Infinite times
Answer:
b) 9

Question 82.
In ………… loop, the body of the loop will be executed atleast once.
a) while
b) do..while
c) for
d) All the above
Answer:
b) do..while

Question 83.
In ……………….. loop, the body of the loop is executed at least once, even when the condition evaluates false during the first iteration.
a) while
b) do..while
c) for
d) All the above
Answer:
b) do..while

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 84.
What will be the output of the following program?
using namespace std;
int main ()
{
int n = 10;
do
{
cout<<n<<“”; n-; }while (n>0);
}
a) 109 8 7 6 5 43 2 1
b) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
c) 1 2 3 4 5 6 7 8 9 10
d) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,0
Answer:
b) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1

Question 85.
……………. statements are used to interrupt the normal flow of the program.
a) Jump
b) Loop
c) Decision making
d) None of these
Answer:
a) Jump

Question 86.
……………. is a jump statement.
a) go to statement
b) break statement
c) continue statement
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 87.
The ………….. statement is a control statement which is used to transfer the control from one place to another place without any condition in a program.
a) go to
b) break
c) continue
d) All the above
Answer:
a) go to

Question 88.
A …………… statement is a jump statement which terminates the execution of the loop and the control is transferred to resume normal execution after the body of the loop.
a) go to
b) break
c) continue
d) All the above
Answer:
b) break

Question 89.
…………….. statement forces the loop to continue or execute the next iteration,
a) go to
b) break
c) continue
d) All the above statement is executed in
Answer:
c) continue

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 90.
When the …………….statement is executed in the loop, the code inside the loop following the …………… statement will be skipped and the next iteration of the loop will begin.
a) go to
b) break
c) continue
d) All the above
Answer:
c) continue

Question 91.
……………. statement breaks the iteration.
a) continue
b) break
c) Both A and B
d) None of these
Answer:
b) break

Question 92.
…………… statement skips the iteration.
a) continue
b) break
c) Both A and B
d) None of these
Answer:
a) continue

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 93.
…………….. statement is used with loops as well as switch case.
a) continue
b) break
c) Both A and B
d) None of these
Answer:
b) break

Question 94.
………….. statement is only used in loops.
a) continue
b) break
c) Both A and B
d) None of these
Answer:
a) continue

Very Short Answers (2 Marks)

Question 1.
What is an if statement? Write its syntax.
Answer:
The if statement evaluates a condition, if the condition is true then a true – block (a statement or set of statements) is executed, otherwise the true – block is skipped. The general syntax of the if the statement is:
if (expression)
true – block;
statement – x;

Question 2.
What are the basic control structures?
Answer:
The basics of control structures are:

  • Selection statement
  • Iteration statement
  • Jump statement

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 3.
What is a computer program?
Answer:
A computer program is a set of statements or instructions to perform a specific task.

Question 4.
What is nested if? Mention its types.
Answer:
An if statement contains another if the statement is called nested if. The nested can have, one of the following three forms.

  1. If nested inside if part
  2. If nested inside else part
  3. If nested inside both if part and else part

Question 5.
What are control statements?
Answer:
Control statements are statements that alter the sequence of flow of instructions.
In a program, statements may be executed sequentially, selectively, or iteratively. Every programming language provides statements to support sequence, selection (branching), and iteration.

Question 6.
What is the exit condition of a loop?
Answer:
The condition on which the execution or exit from the loop is called exit-condition or test-condition.

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 7.
What is an iteration or loop?
Answer:
An iteration or loop is a sequence of one or more statements that are repeatedly executed until a condition is satisfied. These statements are also called control flow statements.

Question 8.
What are the advantages of a loop or an iteration?
Answer:
It is used to reduce the length of code, to reduce time, to execute the program, and takes less memory space

Question 9.
What are loop elements?
Answer:
Every loop has four elements that are used for different purposes. These elements are

  1. Initialization expression
  2. Test expression
  3. Update expression
  4. The body of the loop

Question 10.
What are the parts of a loop?
Answer:
Every loop has four elements that are used for different purposes. These elements are:

  • Initialization expression
  • Test expression
  • Update expression
  • The body of the loop

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 11.
Write a note on the declaration of a variable in a for a loop.
Answer:
Declaration of a variable in a for loop:
In C++, the variables can also be declared within a for loop.
For instance,
for(int i=0; i<=5; ++i)
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 13
A variable declared inside the block of main() can be accessed anywhere inside main() i.e., the scope of variable in main().

Question 12.
Write a program to display numbers from 1 to 10 except 6 using a continue statement.
Answer:
C++ program to display numbers from 1 to 10 except 6 using continue statement
#include
using namespace std;
int main()
{
if (i = 6)
continue;
else
cout << i << ” ”
}
return 0;
}
Output:
1 2 3 4 5 7 8 9 10

Question 13.
Write about the go-to statement.
Answer:
go to the statement: The go-to statement is a control statement which is used to transfer the control from one place to another place without any condition in a program.
The syntax of the go-to statement is;
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 14
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 16
In the syntax above, the label is an identifier. When go-to label; is encountered, the control of the program jumps to label: and executes the code below ¡t.

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 14.
Write a note on the break statement.
Answer:
break statement: A break statement is a jump statement which terminates the execution of the loop and the control is transferred to resume normal execution after the body of the loop. The following figure shows the working of break statement with looping statements;
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 15

Question 15.
Write a note on the continue statement.
Answer:
continue statement:
The continue statement works quite similar to the break statement. Instead of terminating the loop, the continue statement forces the loop to continue or execute the next iteration. When the continue statement is executed in the loop, the code inside the loop following the continue statement will be skipped and the next iteration of the loop will begin.
The following figure describes the working flow of the continue statement
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 17

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Short Answers 3 Marks

Question 1.
Write a note on the sequence statement.
Answer:
sequence statement:
The sequential statement is the statements, that are executed one after another only once from top to bottom. These statements do not alter the flow of execution. These statements are called sequential flow statements. They always end with a semicolon (;).
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 18

Question 2.
What is a selection statement? Mention its types.
Answer:
Selection statement: The selection statement means the statement (s) are executed depends upon a condition. If a condition is true, a true block is executed otherwise a false block is executed. This statement is also called a decision statement or selection statement because it helps in making a decision about which set of statements are to be executed.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 19

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 3.
Explain the Iteration statement.
Answer:
Iteration statement: The iteration statement is a set of the statement are repetitively executed depends upon conditions. If a condition evaluates to true, the set of statements (true block) is executed again and again. As soon as the condition becomes false, the repetition stops. This is also known as a looping statement or iteration statement.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 20

Question 4.
Explain if statement with syntax and an example.
Answer:
The if statement evaluates a condition, if the condition is true then a true-block is executed, otherwise, the true-block is skipped.
Syntax: if (expression) true-block; statement-x;
In the above syntax, if is a keyword that should contain expression or condition which is enclosed within parentheses. Working of if statement: If the expression is true then the true-block is executed and followed by statement-x is also executed, otherwise, the control passes to statement-x. It is implemented in the following flowchart.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 21
Example 1:
if ( qty> 500)
dis=10;
Example 2:
if(age>=18)
cout<< “\n You are eligible for voting ….”;

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 5.
Explain if..else statement with syntax and an example.
Answer:
The syntax of the if..else statement:
if (expression)
{
True-block;
}
else
{
False-block;
}
Statement-x
Working of if..else statement:
In if..else statement, first the expression or condition is evaluated as either true or false. If the result is true, then the statements inside the true-block are executed and the false-block is skipped. If the result is false, then the statement inside the false-block is executed i.e., the true-block is skipped. It is implemented in the following flowchart.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 22
Example:
if(num%2==0)
cout<< “\n The given number is Even”;
else
cout<< “\n The given number is Odd”;

Question 6.
What is a conditional or ternary operator? Explain.
Answer:
The conditional operator (or Ternary operator) is an alternative for the ‘if-else statement’. The conditional operator consists of two symbols (?:). It takes three arguments. The control flow of the conditional operator is shown below.
The syntax of the conditional operator is:
expression 1? expression 2: expression 3
In the above syntax, expression 1 is a condition which is evaluated, if the condition is true (Non-zero), then the control is transferred to expression 2, otherwise, the control passes to expression 3.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 23
Example:
#include
using namespace std;
int main()
{
int a, b, largest;
cout << “\n Enter any two numbers:
cin >> a >> b;
largest = (a>b)? a : b;
cout << “\n Largest number: ” << largest;
return 0;
}
Output
Enter any two numbers: 12 98
Largest number: 98

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 7.
Explain the nested switch statement.
Answer:
Nested switch:
When a switch is a part of the statement sequence of another switch, then it is called a nested switch statement. The inner switch and the outer switch constant may or may not be the same.
The syntax of the nested switch statement is: switch (expression)
{
case constant 1:
statement(s);
break;
switch(expression)
{
case constant 1:
statement(s);
break;
case constant 2:
statement(s);
break;
.
.
.
default: statement(s);
}
case constant 2:
statement(s);
break;
.
.
.
default:
statement(s);
}
Example:
#include
using namespace std;
int main()
{
int a = 8;
cout<<“The Number is : ” < switch (a)
{
case 0 :
cout<<“The number is zero” <<endl;
break;
default:
cout<<“The number is a non-zero
integer” <<endl;
int b = a % 2;
switch (b)
{
case 0:
cout<<“The number is even” <<endl;
break;
case 1:
cout<<“The number is odd” <<endl;
break;
}
}
return 0;
}
Output
The Number is: 8
The number is a non-zero integer
The number is even

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 8.
Explain variations of for loop?
Answer:
Variations of for loop:
Variations increase the flexibility and applicability of for loop.
Multiple initializations and multiple update expressions:
Multiple statements can be used in the initialization and update expressions of for loop.
This multiple initializations and multiple update expressions are separated by commas.
For example:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 24
Output
The value of i is 0 The value of j is 10
The value of i is 1 The value of j is 9
The value of i is 2 The value of j is 8
The value of i is 3 The value of j is 7
The value of i is 4 The value of j is 6
In the above example, the initialization part contains two variables i and j, and the update expression contains i++ and j++. These two variables are separated by commas which are executed in sequential order i.e., during initialization firstly i-0 followed by j=10. Similarly, in update expression, firstly i++ is evaluated followed by j++ is evaluated.

Question 9.
Explain for loop optional expression with suitable examples.
Answer:
Optional expressions;
The for loop contains three parts, i.e., initialization expressions, test expressions and
update expressions. These three expressions are optional in a for loop.
Case 1:
#include
using namespace std;
int main ()
{
int i, sum=0, n;
cout<<“\n Enter The value of n”;
cin>>n;
i =1;
for (; i<=10;i++)
{
sum += i;
}
cout<<“\n The sum of 1 to” <<n<<“is “<<sum;
return 0;
}
Output
Enter the value of n 5
The sum of 1 to 5 is 15
In the above example, variable i is declared and the sum is initialized at the time of variable declaration.
The variable i is assigned to 0 before the for loop but still, the semicolon is necessary before test expression.
In a for loop, if the initialization expression is absent then the control is transferred to the test expression/conditional part.
Case 2:
#include
using namespace std;
int main ()
{
int i, sum=0, n;
cout<<“\n Enter The value of n”; cin>>n;
i =1;
for (; i<=10; )
{
sum += i;
++i;
cout<<“\n The sum of 1 to” <<n<<“is “<<sum;
return 0;
}
Output
Enter the value of n 5
The sum of 1 to 5 is 15
In the above code, the update expression is hot done, but a semicolon is necessary before the update expression.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 25
In the above code, neither the initialization nor the update expression is done in the for a loop. If both or any one of the expressions are absent then the control is transferred to the conditional part.
Case 3:
An infinite loop will be formed if a test- expression is absent in a for a loop.
For example:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 26

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 10.
What is an empty loop? Give a suitable example.
Answer:
Empty loop:
An empty loop means a loop that has no statement in its body is called an empty loop. Following for loop is an empty loop:
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 27
In the above code, the for loop contains a null statement, it is an empty loop.
Similarly, the following for loop also forms an empty loop.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 28
In the above code, the body of a for loop enclosed by braces is not executed at all because a semicolon is ended after the for a loop.

Question 11.
What do you mean by the nesting of loops?
Answer:
Nesting of loops:
A loop which contains another loop is called a nested loop.
The syntax is given below:
for (initialization(s); test-expression; update expression(s))
{
for (initialization(s); test-expression; update expression(s)
{
statement(s);
}
statement(s);
{
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 29
Example:
#include
using namespace std;
int main(void)
{
cout<< “A multiplication table:”
< <<endl<< “” <<endl;
for(int c = 1; c < 10; C++)
{
cout<< c << “l”;
for(int i = 1; i< 10; i++)
{
cout< }
cout<<endl;
}
return 0;
}

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 12.
What are the Differences between the Break and Continue statement?
Answer:

Break

Continue

The break is used to terminate the execution of the loop. Continue is not used to terminate the execution of the loop.
It breaks the iteration. It skips the iteration.
When this statement is executed, control will come out from the loop and executes the statement immediately after the loop. When this statement is executed, it will not come out of the loop but moves/jumps to the next iteration of the loop.
The break is used with loops as well as switch cases. Continue is only used in loops, it is not used in switch cases.

Book Evaluation

Hands-On Practice
Write a C++ program to solve the following problems:
Question 1.
Temperature – conversion program that gives the user the option of converting Fahrenheit to Celsius or Celsius to Fahrenheit and depending upon the user’s choice.
Answer:
PROGRAM :
using namespace std;
#include<iostream>
int main()
{
float f,c;
int choice;
cout<<“\nl, FahrenheiT to Celsius”;
cout<<“\n2. Celsius to FahrenheiT”;
cout<<“\n3.Exit”;
cout<<“\nENTER YOUR CHOICE “;
cin>>choice;
switch(choice)
{
case 1: cout<<“\nENTER TEMPERATURE IN FAHRENHEIT “;
cin>>f;
c=5.0/9.0 *(f-32);
cout<<“\nTEMPERATURE IN FAHRENHEIT “<<f;
cout«”\nTEMPERATURE IN CELSIUS “<<c;
break;
case 2: cout<<“\nENTER TEMPERATURE IN CELSIUS “;
cin>>c;
f = 9*c/5 + 32;
cout< <“\nTEMPERATURE IN FAHRENHEIT “<<f;
cout< < “\nTEMPERATURE IN CELSIUS “<<c;
break;
default: cout< <“\nPROCESS COMPLETED”; > .
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 30

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 2.
The program requires the user to enter two numbers and an operator. It then carries out the specified arithmetical operation: addition, subtraction, multiplication, or division of the two numbers. Finally, it displays the result.
using namespace std;
#include <iostream>
int main()
{
float num1,num2,result;
char op;
coutczcz”\nl. Enter two numbers”;
cin>>num1>>num2;
cout<<”\nEnter operaotr + or – or * or / : “; cin>>op;
switch(op)
{
case’+’:
result = num1 + num2;
cout<<“\nAdded value “<<result;
break;
case’-‘:
result = num1 – num2;
cout<<“\nSubtracted value “<<result;
break;
case ‘*’:
result = num1 * num2;
cout<<“\Multiplied value “<<result;
break;
case’/’:
result = num1 / num2;
cout<<“\nDivided value “<<result;
break;
default:cout<<“\nPROCESS COMPLETED”;
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 31
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 32

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 3.
Program to input a character and to print whether a given character is an alphabet, digit or any other character.
Answer:
PROGRAM
using namespace std;
#include <iostream>
#include
int main()
{
char ch;
cout<<“\nl. Enter a character :”; cin>>ch;
if(isdigit(ch))
cout<<“\nThe given character “<<ch<<” is a digit”;
else if(isalpha(ch))
cout<<“\nThe given character “<<ch<<” is an alphabet”;
else
cout<<“\nThe given character “<<ch<<” is other character”;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 33

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 4.
Program to. print whether a given character Is an uppercase or a lowercase character or a digit or any other character. Use ASCII codes for it. The ASCII codes are as given below:
Answer:
Characters -ASCII Range
‘0’ – ‘9’ – 48 – 57
‘A’ – ‘Z’ – 65 – 90
‘a’ – ‘z’ – 97 – 122
other characters 0 – 255 excluding the above-mentioned codes.
PROGRAM
using namespace std;
#include
int main()
{
char ch;
cout<<“\nl. Enter a character: cin>>ch;
int av = ch;
if(av>47 m av<58)
cout<<“\nThe given character “<<ch<<” is a digit”; else if(av>64 && av<91)
cout<<“\nThe given character “<<ch<<” is an Uppercase character”; else if(av>96 && av < 123)
cout<<“\nThe given character “<<ch<<” is n Lowercase character”;
else
cout<<“\nThe given character “<<ch<<” is an Other character”;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 34
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 35

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 5.
Program to calculate the factorial of an integer.
Answer:
PROGRAM
using namespace std;
#include
int main()
{
int i,n;
long int fact=l;
cout<<“\nEnter a number… cin>>n; ‘
for(i=l; i<=n; i++)
fact = fact * i;
cout<<“\nFactorial of “<<n<<” is “<<fact;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 36

Question 6.
Program that print 1 2 4 8 16 32 64 128.
Answer:
PROGRAM
using namespace std;
#include
int main()
{
int i;
for(i=l; i< =128; i=i*2)
cout<<i<<“\t”;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 37

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 7.
Program to generate divisors of an integer.
Answer:
PROGRAM
using namespace std;
#include
int main() {
int n,d;
cout<<“\n Enter a number…”; cin>>n;
cout<<“\nThe divisors for “< for(d=l; d<=n/2;d++)
if(n%d==0)
cout<<d<<“\t”;
cout<<n;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 38

Question 8.
Program to print fibonacci series i.e., 0112 3 5 8
Answer:
PROGRAM
using namespace std;
#include
int main()
{
int n,fl,f2,f3;
fl=-l; ,
f2=l;
cout«”\nHOW MANY TERMS … “; .
cin>>n;
cout<<,r\nThe FIBONACCI TERMS ARE \n”; for(int i=l; i<=h;i++)
{
f3=fl+f2;
cout<<f3<<“\n”;
fl-f2;
f2=f3;
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 39

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 9.
Programs to produces the following design using nested loops.
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 41
Answer:
9. A)
PROGRAM
using namespace std;
#include
int main()
{
int i,j;
for(i=l; i<=6; i++)
{
char c = ‘A’; for(j=l;j<=i;j++)
{
cout<<c<<“\t”;
C++;
}
cout<<“\n\n”;
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 42
9. B)
PROGRAM
using namespace std;
#include
int main()
{
int i,j;
for(i=l; i<=5; i++) { for(j=5;j>=i;j–)
cout<<j<<“\t”;
cout<<“\n\n”;
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 43
9.c)
PROGRAM
using namespace std;
#include
int main()
{
int i,j,k=0,m;
for(i=7; i> = l; i=i-2)
{
for(j=l;j<=i;j++)
cout<<“#\t”;
cout<<“\n\n”;
k++;
for(m=l;m<=k;m++)
cout<<“\t”;
}
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 44

Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control

Question 10.
Program to check whether the square root of a number is a prime or not.
Answer:
PROGRAM
using namespace std;
#include
#include int main()
{
int n,srn,d,p=0;
cout<<“\nENTER A NUMBER … cin>>n;
srn=sqrt(n);
cout<<“\nTHE GIVEN NUMBER IS “<<n;
cout<<“\nTHE SQUARE ROOT OF”<<n<<” IS”<<srn;
for(d=2; d<=srn/2;d++)
{
if(srn%d==0)
{
p=1;
break;
}
}
if(p==0)
cout <<“\nTHE SQUARE ROOT OF THE GIVEN NUMBER “<<n<<” IS A PRIME”; else
cout <<“\nTHE SQUARE ROOT OF THE GIVEN NUMBER “<<n<<” IS NOT A PRIME”;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 10 Flow of Control 45

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Tamilnadu State Board New Syllabus Samacheer Kalvi 11th Computer Science Guide Pdf Chapter 9 Introduction to C++ Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 11th Computer Science Solutions Chapter 9 Introduction to C++

11th Computer Science Guide Introduction to C++ Text Book Questions and Answers

Book Evaluation
Part I

Choose The Correct Answer

Question 1.
Who developed C++?
a) Charles Babbage
b) Bjarne Stroustrup
c) Bill Gates
d) Sundar Pichai
Answer:
b) Bjarne Stroustrup

Question 2.
What was the original name given to C++?
a) CPP
b) Advanced C
c) C with Classes
d) Class with C
Answer:
c) C with Classes

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Who coined C++?
a) Rick Mascitti
b) Rick Bjarne
c) Bill Gates
d) Dennis Ritchie
Answer:
a) Rick Mascitti

Question 4.
The smallest individual unit in a program is:
a) Program
b) Algorithm
c) Flowchart
d) Tokens
Answer:
d) Tokens

Question 5.
Which of the following operator is extraction operator of C++?
a) >>
b) <<
c) <>
d) AA
Answer:
a) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 6.
Which of the following statements is not true?
a) Keywords are the reserved words convey specific meaning to the C++ compiler.
b) Reserved words or keywords can be used as an identifier name.
c) An integer constant must have at least one digit without a decimal point.
d) Exponent form of real constants consists of two parts
Answer:
b) Reserved words or keywords can be used as an identifier name.

Question 7.
Which of the following is a valid string literal?
a) ‘A’
b) ‘Welcome’
c) 1232
d) “1232”
Answer:
d) “1232”

Question 8.
A program written in high level language is called as ………………………
a) Object code
b) Source code
e) Executable code
d) All the above
e) Executable code
Answer:
b) Source code

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 9.
Assume a=5, b=6; what will be result of a & b?
a) 4
b) 5
c) 1
d) 0
Answer:
a) 4

Question 10.
Which of the following is called as compile time operators?
a) size of
b) pointer
c) virtual
d) this
Answer:
a) sizeof

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Part – II

Very Short Answers

Question 1.
What is meant by a token? Name the token available in C++.
Answer:
C++ program statements are constructed by many different small elements such as commands, variables, constants, and many more symbols called operators and punctuators. Individual elements are collectively called Lexical units or Lexical elements or Tokens.
C++ has the following tokens:

  1. Keywords
  2. Identifiers
  3. Literals
  4. Operators
  5. Punctuators

Question 2.
What are keywords? Can keywords be used as identifiers?
Answer:
Keywords:
Keywords are the reserved words which convey specific meaning to the C++ compiler.
They are the essential elements to construct C++ programs.
Example:
int / float / auto / register Reserved words or keywords cannot be used as an identifier name.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
The following constants are of which type?

  1. 39
  2. 032
  3. OXCAFE
  4. 04.14

Answer:

  1. 39 – Decimal
  2. 032 – Octal
  3. OXCAFE – Hexadecimal
  4. 04.14 – Decimal

Question 4.
Write the following real constants into the exponent form:
i) 23.197
ii) 7.214
iii) 0.00005
iv) 0.319
Answer:
i) 23.197 : 0.23197 E2 (OR) 2.3197 E1 (OR) 23197E-3
ii) 7.214 : 0.7214 E1 (OR) 72.14 E-1 (OR) 721.4 E-2 (OR) 7214E-3
iii) 0.00005 : 5E-5
iv) 0.319 : 3.19 E-l (OR) 31.9 E-2 (OR) 319 E-3

Question 5.
Assume n=10; what will be result of n>>2;?
Answer:
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 1

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 6.
Match the following:

A

B

(a) Modulus (1) Tokens
(b) Separators (2) Remainder of a division
(c) Stream extraction (3) Punctuators
(d) Lexical Units (4) get from

Answer:
a) 2
b) 3
c) 4
d) 1

Part – III

Short Answers

Question 1.
Describe the differences between keywords and identifiers.
Answer:
Keywords:

  • Keywords are the reserved words which convey specific meaning to the C++ compiler.
  • They are essential elements to construct C++ programs.
  • Most of the keywords are common to C, C++, and Java.

Identifiers:

  • Identifiers are the user-defined names given to different parts of the C++ program.
  • They are the fundamental building blocks of a program.
  • Every language has specific rules for naming the identifiers.

Question 2.
Is C++ case sensitive? What is meant by the term “case sensitive”?
Answer:
Yes. C++ is case sensitive as it treats upper and lower-case characters differently.
Example: NUM, Num, num are different in C++.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Differentiate “=” and “==”.
Answer:

  • ‘=’ is an assignment operator which is used to assign a value to a variable which is on the left hand side of an assignment statement.
  • ‘=’operator copies the value at the right side
    of the operator to the left side variable. Ex. num = 10; means 10 assign to the variable num.
  • ‘= =’ is a relational operator. It is used to compare both operands are same or not.
  • Ex. num = = 10 means it compare num value with 10 and returns true(l) if both are same or returns false(0)

Question 4.
Assume a=10, b=15; What will be the value of a∧b?
Answer:
Bitwise XOR (∧) will return 1 (True) if only one of the operand is having a value 1 (True). If both are True or both are False, it will return 0 (False).
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 2

Question 5.
What is the difference between “Run time error” and “Syntax error”?
Answer:
Run time Error:

  • A run time error occurs during the execution of a program. It occurs because of some illegal operation that takes place.
  • For example, if a program tries to open a file which does not exist, it results in a run-time error.

Syntax Error:

  • Syntax errors occur when grammatical rules of C++ are violated.
  • For example: if you type as follows, C++ will throw an error.
    cout << “Welcome to Programming in C++”

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 6.
What are the differences between “Logical error” and “Syntax error”?
Answer:

  • A Program has not produced the expected result even though the program is grammatically correct. It may be happened by the wrong use of variable/operator/order of execution etc. This means, the program is grammatically correct, but it contains some logical error. So, a Semantic error is also called a “Logic Error”.
  • Syntax errors occur when grammatical rules of C++ are violated.

Question 7.
What is the use of a header file?
Answer:
Header files contain definitions of Functions and Variables, which are imported or used into any C++ program by using the preprocessor #include statement. Header files have an extension “.h” which contains C++ function declaration and macro definition.
Example: #include

Question 8.
Why is main function special?
Answer:
Every C++ program must have a main function. The main() function is the starting point where all C++ programs begin their execution. Therefore, the executable statements should be inside the main() function.

Question 9.
Write two advantages of using include compiler directive.
Answer:

  1. The program is broken down into modules, thus making it more simplified.
  2. More library functions can be used, at the same time size of the program is retained.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Write the following in real constants.

  1. 15.223
  2. 211.05
  3. 0.00025

Answer:

  1. 15.223 → 1.5223E1 → 0.15223E2 → 15223E-3
  2. 211.05 → 2.1105E2 → 21105 E-2
  3. 0.00025 → 2.5E-4

Part – IV

Explain In Detail

Question 1.
Write about Binary operators used in C++.
Answer:
Binary Operators require two operands:
Arithmetic operators that perform simple arithmetic operations like addition, subtraction, multiplication, division (+, -, *, %, /), etc. are binary operators which require a minimum of two operands.

Relational operators are used to determining the relationship between its operands. The relational operators (<, >, >=, <=, ==, !=) are applied on two operands, hence they are binary operators. AND, OR (logical operator) both are binary operators. The assignment operator is also a binary operator (+=, – =, *=, /=, %=).

Question 2.
What are the types of Errors?
Answer:
COMMON TYPES OF ERRORS

Type of Error

Description

Syntax Error Syntax is a set of grammatical rules to construct a program. Every programming language has unique rules for constructing the sourcecode.
Syntax errors occur when grammatical rules of C++ are violated.
Example: if we type as follows, C++ will throw an error.
cout << “Welcome to C++”
As per grammatical rules of C++, every executable statement should terminate with a semicolon. But, this statement does not end with a semicolon.
Semantic error’ A Program has not produced expected result even though the program is grammatically correct. It may be happened by the wrong use of variable/operator/order of execution etc. This means, the program is grammatically correct, but it contains some logical error. So, Semantic error is also called a “Logic Error”.
Run­ time error  A run time error occurs during the execution of a program. It occurs because of some illegal operation that takes place.
For example, if a program tries to open a file which does not exist, it results in a run-time error.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Assume a=15, b=20; What will be the result of the following operations?
a) a&b
b) a|b
c) aAb
d)a>>3
e) (~b)
Answer:
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 3

11th Computer Science Guide Introduction to C++ Additional Questions and Answers

Choose The Correct Answer

Question 1.
The latest standard version published in December 2017 as ISO/IEC …………….. which is informally known as C++ 17.
(a) 14882 : 1998
(b) 14883 : 2017
(c) 14882 : 2017
(d) 14882 : 2000
Answer:
(c) 14882 : 2017

Question 2.
C++ language was developed at ……………….
a) Microsoft
b) Borland International
c) AT & T Bell Lab
d) Apple Corporation
Answer:
c) AT & T Bell Lab

Question 3.
An integer constant is also called……………..
(a) fixed point constant
(b) floating-point constant
(c) real constants
(d) Boolean literals
Answer:
(a) fixed point constant

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
C++supports ………… programming paradigms.
a) Procedural
b) Object-Oriented
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 5.
…………….. relational operators are binary operators.
(a) 7
(b) 8
(c) 6
(d) 2
Answer:
(c) 6

Question 6.
C++ is a superset (extension) of …………….. language.
a) Ada
b) BCPL
c) Simula
d) C
Answer:
d) C

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7
…………….. used to label a statement.
(a) colon
(b) comma
(c) semicolon
(d) parenthesis
Answer:
(a) colon

Question 8.
The name C++ was coined by …………….
a) Lady Ada Lovelace
b) Rick Mascitti
c) Dennis Ritchie
d) Bill Gates
Answer:
b) Rick Mascitti

Question 9.
IDE stands for ……………..
(a) Integrated Development Environment
(b) International Development Environment
(c) Integrated Digital Environment
(d) None of the above
Answer:
(a) Integrated Development Environment

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Till 1983, C++ was referred to as …………………
a) New C
b) C with Classes
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 11.
…………….. data type signed more precision fractional value.
(a) char
(b) short
(c) long double
(d) signed doubles
Answer:
(c) long double

Question 12.
C# (C-Sharp), D, Java, and newer versions of C languages have been influenced by ………………. language.
a) Ada
b) BCPL
c) Simula
d) C++
Answer:
d) C++

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 13.
…………….. manipulator is the member of iomanip header file.
(a) setw
(b) setfill
(c) setf
(d) all the above
Answer:
(d) all the above

Question 14.
C++is ……………… language.
a) Structural
b) Procedural
c) Object-oriented
d) None of these
Answer:
c) Object-oriented

Question 15.
C++ includes ………………..
a) Classes and Inheritance
b) Polymorphism
c) Data abstraction and Encapsulation
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 16.
C language does not allow ………………
a) Exception handling
b) Inheritance
c) Function overloading
d) All the above
Answer:
d) All the above

Question 17.
……………. is a set of characters which are allowed to write a C++ program.
a) Character set
b) Tokens
c) Punctuators
d) None of these
Answer:
a) Character set

Question 18.
A character represents any …………………..
a) Alphabet
b) Number
c) Any other symbol (special characters)
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 19.
Most of the Character set, Tokens, and expressions are very common to C based programming languages like ………………..
a) C++
b) Java
c) PHP
d) All the above
Answer:
d) All the above

Question 20.
…………… is a white space.
a) Horizontal tab
b) Carriage return
c) Form feed
d) All the above
Answer:
d) All the above

Question 21.
C++ program statements are constructed by many different small elements called……………….
a) Lexical units
b) Lexical elements
c) Tokens
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 22.
…………… is a C++token.
a) Keywords
b) Identifiers and Literals
c) Punctuators and Operators
d) All the above
Answer:
d) All the above

Question 23.
The smallest individual unit in a program is known as a ……………
a) Token
b) Lexical unit
c) Token or a Lexical unit
d) None of these
Answer:
c) Token or a Lexical unit

Question 24.
………………… are the reserved words which convey specific meaning to the C++ compiler.
a) Keywords
b) Identifiers and Literals
c) Punctuators and Operators
d) All the above
Answer:
a) Keywords

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 25.
………………. are the essential elements to construct C++ programs.
a) Keywords
b) Identifiers and Literals
c) Punctuators and Operators
d)All the above
Answer:
a) Keywords

Question 26.
Most of the keywords are common to …………… languages.
a) C, and C++
b) C++ and Java
c) C, C++ and Java
d) None of these
Answer:
c) C, C++ and Java

Question 27.
……………. is a case sensitive programming language.
a) C, and C++
b) C++ and Java
c) C, C++ and Java
d) None of these
Answer:
c) C, C++ and Java

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 28.
In ……………. language, all the keywords must be in lowercase.
a) C, and C++
b) C++ and Java
c) C, C++ and Java
d) None of these
Answer:
c) C, C++ and Java

Question 29.
……………… is a new keyword in C++.
a) using
b) namespace
c) std
d) All the above
Answer:
d) All the above

Question 30.
…………….. is a new keyword in C++.
a) bal
b) static_cast
c) dynamic_cast
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 31.
………….. is a new keyword in C++.
a) true
b) false
c) Both A and B
c) None of these
Answer:
c) None of these

Question 32.
Identifiers are the user-defined names given to …………..
a) Variables and functions
b)Arrays
c) Classes
d) All the above
Answer:
d) All the above

Question 33.
Identifiers containing a …………. should be avoided by users.
a) Double underscore
b) Underscore
c) number
d) None of these
Answer:
a) Double underscore

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 34.
The first character of an identifier must be an ………….
a) Alphabet
b) Underscore (_)
c) Alphabet or Underscore (_)
c) None of these
Answer:
c) Alphabet or Underscore (_)

Question 35.
Only …………… is permitted for the variable name.
a) Alphabets
b) Digits
c) Underscore
d) All the above
Answer:
d) All the above

Question 36.
Identify the correct statement from the following.
a) C++ is case sensitive as it treats upper and lower-case characters differently.
b) Reserved words or keywords cannot be used as an identifier name.
c) As per ANSI standards, C++ places no limit on its length.
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 37.
ANSI stands for …………..
a) All National Standards Institute
b) Advanced National Standards Institute
c) American National Standards Institute
d) None of these
Answer:
c) American National Standards Institute

Question 38.
Identify the invalid variable name from the following.
a) num-add
b) this
c) 2myfile
d) All the above
Answer:
d) All the above

Question 39.
Identify the odd one from the following.
a) Int
b) _add
c) int
d) tail marks
Answer:
c) int

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 40.
……………… are data items whose values do not change during the execution of a program.
a) Literals
b) Constants
c) Identifiers
d) Both A and B
Answer:
d) Both A and B

Question 41.
…………. is a type constant in C++.
a) Boolean constant
b) Character constant
c) String constant
d) All the above
Answer:
d) All the above

Question 42.
…………… is a type of numeric constant.
a) Fixed point constant
b) Floating-point constant
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 43.
……………. are whole numbers without any fractions.
a) Integers
b) Real constant
c) Floating-point constant
d) None of these
Answer:
a) Integers

Question 44.
In C++, there are …………….. types of integer constants.
a) Two
b) Three
c) Four
d) Six
Answer:
b) Three

Question 45.
In C++, ……………… is a type of integer constant.
a) Decimal
b) Octal
c) Hexadecimal
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 46.
Any sequence of one or more digits (0 …. 9) is called ……………… integer constant.
a) Decimal
b) Octal
c) Hexadecimal
d) All the above
Answer:
a) Decimal

Question 47.
Any sequence of one or more octal values (0 …. 7) that begins with 0 is considered as a(n) …………… constant.
a) Decimal
b) Octal
c) Hexadecimal
d) All the above
Answer:
b) Octal

Question 48.
When you use a fractional number that begins with 0, C++ has consider the number as ………………..
a) An integer not an Octal
b) A floating-point not an Octal
c) An integer not a Hexadecimal
d) None of these
Answer:
a) An integer not an Octal

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 49.
Any sequence of one or more Hexadecimal values (0 …. 9, A …. F) that starts with Ox or OX is considered as a(n) ………….. constant.
a) Decimal
b) Octal
c) Hexadecimal
d) All the above
Answer:
c) Hexadecimal

Question 50.
Identify the invalid octal constant,
a) 05,600
b) 04.56
c) 0158
d) All the above
Answer:
d) All the above

Question 51.
Identify the valid hexa decimal constant
a) 0X1,A5
b) 0X.14E
c) CAFE
d) CPP
Answer:
c) CAFE

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 52.
The suffix ………….. added with any constant forces that to be represented as a long constant.
a) L or I
b) U or u
c) LO
d) Lg
Answer:
a) L or I

Question 53.
The suffix …………… added with any constant forces that to be represented as an unsigned constant.
a) L or I
b) U or u
c) US
d) us
Answer:
b) U or u

Question 54.
A _______ constant is a numeric constant having a fractional component.
a) Real
b) Floating point
c) Real or Floating point
d) None of these
Answer:
c) Real or Floating point

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 55.
……………. constants may be written in fractional form or in exponent form.
a) Real
b) String
c) Character
d) Integer constant
Answer:
a) Real

Question 56.
Exponent form of real constants consists of ………….. parts.
a) three
b) two
c) four
d) five
Answer:
b) two

Question 57.
Exponent form of real constants consists of ……………. part.
a) Mantissa
b) Exponent
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 58.
The mantissa must be a(n) …………. constant.
a) Integer
b) Real
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 59.
58.64 can be written as …………….
a) 5.864E1
b) 0.5864E2
c) 5864E-2
d) All the above
Answer:
d) All the above

Question 60.
Internally boolean true has value ……………
a) 0
b) 1
c) -1
d) None of these
Answer:
b) 1

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 61.
Internally boolean false has value …………….
a) 0
b) 1
c) -1
d) None of these
Answer:
a) 0

Question 62.
A character constant is any valid single character enclosed within ………….. quotes.
a) Double
b) Single
c) No
d) None of these
Answer:
b) Single

Question 63.
Identify the odd one from the following,
a) ‘A’
b) ‘2’
c) ‘$’
d) “A”
Answer:
d) “A”

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 64.
The value of a single character constant has an equivalent ………….. value.
a) BCD
b) ASCII
c) Nibble
d) None of these
Answer:
b) ASCII

Question 65.
The ASCII value of ‘A’ is …………..
a) 65
b) 97
c) 42
d) 75
Answer:
a) 65

Question 66.
The ASCII value of ‘a’ is ……………
a) 65
b) 97
c) 42
d) 75
Answer:
b) 97

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 67.
C++ allows certain non-printable characters represented as ……………. constants.
a) Integer
b) Real
c) Character
d) String
Answer:
c) Character

Question 68.
The non-printable characters can be represented by using …………………………
a) Escape sequences
b) String
c) Boolean
d) None of these
Answer:
a) Escape sequences

Question 69.
An escape sequence is represented by a backslash followed by …………. character(s).
a) One
b) Two
c) One or Two
d) None of these
Answer:
c) One or Two

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 70.
______ is escape sequence for audible or alert bell.
a) \a
b)\b
c) \n
d)\f
Answer:
a) \a

Question 71
_______ is escape sequence for backspace.
a)\a
b)\b
c) \n
d) \f
Answer:
b)\b

Question 72.
______ is escape sequence for form feed.
a)\a
b)\b .
c) \n
d) \f
Answer:
d) \f

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 73.
______ is escape sequence for new line or line feed.
a) a
b)\b
c)\n
d)\f
Answer:
c)\n

Question 74.
……………. is escape sequence for carriage return.
a)\r
b)\c
c)\n
d)\cr
Answer:
a)\r

Question 75.
______ is escape sequence for horizontal tab.’
a)\a ‘
b)\b
c)\t
d)\f
Answer:
c)\t

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 76.
_______ is escape sequence for vertical tab.
a)\v
b)\b
c) \t
d) \f
Answer:
a)\v

Question 77.
………………. is escape sequence for octal number.
a) \On
b) \xHn
c)\O
d)O
Answer:
a) \On

Question 78.
______ is escape sequence for hexadecimal number.
a) \On
b) \xHn
c)\O
d)\O
Answer:
b) \xHn

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 79
______ ¡s escape sequence for Null character.
a) \On
b) \xHn
c)\O
d)\n
Answer:
c)\O

Question 80.
______ ¡s escape sequence for Inserting?
a) \?
b) \\
c)\’
d)\”
Answer:
a) \?

Question 81.
______ is an escape sequence for inserting a single quote.
a)\?
b)\\
c) \‘
d) \“
Answer:
c) \‘

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 82.
______ is escape sequence for inserting double quote.
a)\?
b)\\
c) \‘
d) \“
Answer:
d) \“

Question 83.
______ is escape sequence for inserting
a)\?’
b)\\
c) \‘
d) \“
Answer:
b)\\

Question 84.
ASCII was first developed and published in 1963 by the …………. Committee, a part of the American Standards Association (ASA).
a) X3
b) A3
c) ASA
d) None of these
Answer:
a) X3

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 85.
Sequence of characters enclosed within ………. quotes are called as String literals,
a) Single
b) Double
c) No
d) None of these
Answer:
b) Double

Question 86.
By default, string literals are automatically added with a special character………..at the end.
a) ‘\0’ (Null)
b) ‘\S’
c) V
d) None of these
Answer:
a) ‘\0’ (Null)

Question 87.
Identify the valid string constant from the following.
a) “A”
b) “Welcome”
c) “1234”
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 88.
The symbols which are used, to do some mathematical or logical operations are called as ………………
b) Operands
d) None of these
a) Operators
c) Expressions
Answer:
a) Operators

Question 89.
The data items or values that the operators act upon are called as ……………
a) Operators
b) Operands
c) Expressions
d) None of these
Answer:
b) Operands

Question 90.
In C++, the operators are classified as ………… types on the basis of the number of operands,
a) two
b) three
c) four ,
d) five
Answer:
b) three

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 91.
………….. operators require only one operand.
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
a) Unary

Question 92.
…………… operators require two operands.
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
b) Binary

Question 93.
………… operators require three operands.
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
c) Ternary

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 94.
C++ operators are classified as …………… types
a) 7
b) 3
c) 10
d) 4
Answer:
a) 7

Question 95.
…………… operators perform simple operations like addition, subtraction, multiplication, division etc.
a) Logical
b) Relational
c) Arithmetic
d) Bitwise
Answer:
c) Arithmetic

Question 96.
…………… operator is used to find the remainder of a division.
a) /
b) %
c) *
d) **
Answer:
b) %

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 97.
…………….. operator is called as Modulus operator.
a) /
b)%
c) *
d) **
Answer:
b)%

Question 98.
An increment or decrement operator acts upon a …………….. operand and returns a new value,
a) Single
b) Two
c) Three
d) None of these
Answer:
a) Single

Question 99.
………….. is a unary operator.
a) ++
b) —
c) Both ++ and —
d) None of these
Answer:
c) Both ++ and —

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 100.
The increment operator adds …………….. to its operand.
a) 1
b) 0\
c) -1
d) None of these
Answer:
a) 1

Question 101.
The decrement operator subtracts …………… from its operand.
a) 1
b) 0\
c) -1
d) None of these
Answer:
a) 1

Question 102.
The …………….. operators can be placed either as prefix (before) or as postfix (after) to a variable.
a) ++
b) –
c) ++or–
d) None of these
Answer:
c) ++or–

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 103.
With the prefix version, C++ performs the increment/decrement………….. using the operand.
a) Before
b) After
c) When required
d) None of these
Answer:
a) Before

Question 104.
With the postfix version, C++ performs the increment/decrement…………….. using the operand.
a) Before
b) After
c) When required
d) None of these
Answer:
b) After

Question 105.
With the postfix version, C++ uses the value of the operand in evaluating the expression …………… incrementing /decrementing its present value.
a) Before
b) After
c) When required
d) None of these
Answer:
a) Before

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 106.
……………… operators are used to determining the relationship between its operands.
a) Logical
b) Relational
c) Arithmetic
d) Bitwise
Answer:
b) Relational

Question 107.
When the relational operators are applied on two operands, the result will be a …………… value.
a) Boolean
b) Numeric
c) Character
d) String
Answer:
a) Boolean

Question 108.
C++ provides …………. relational operators.
a) Seven
b) six
c) Eight
d) Five
Answer:
b) six

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 109.
All six relational operators are ……………
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
b) Binary

Question 110.
A logical operator is used to evaluate …………… expressions.
a) Logical and Relational
b) Logical
c) Relational
d) None of these
Answer:
a) Logical and Relational

Question 111.
Which logical operator returns 1 (True), if both expressions are true, otherwise it returns 0 (false)?
a) AND
b) OR
c) NOT
d) All the above
Answer:
a) AND

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 112.
Which logical operator returns 1 (True) if either one of the expressions is true. It returns 0 (false) if both the expressions are false?
a) AND
b) OR
c) NOT
d) All the above
Answer:
b) OR

Question 113.
Which logical operator simply negates or inverts the true value?
a) AND
b) OR
c) NOT
d) All the above
Answer:
c) NOT

Question 114.
AND, OR both are ……………. operators.
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
b) Binary

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 115.
NOT is a(n) …………… operator.
a) Unary
b) Binary
c) Ternary
d) None of these
Answer:
a) Unary

Question 116.
Identify the correct statement from the following.
a) The logical operators act upon the operands that are themselves called logical expressions.
b) Bitwise operators work on each bit of data and perform the bit-by-bit operations.
c) There are two bitwise shift operators in C++, Shift left (<<) & Shift right (>>).
d) All the above
Answer:
d) All the above

Question 117.
In C++, there are …………… kinds of bitwise operator.
a) Three
b) Four
c) Two
d) Five
Answer:
a) Three

Question 118.
…………. is a type of bitwise operator.
a) Logical bitwise operators
b) Bitwise shift operators
c) One’s compliment operators
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 119.
______ will return 1 (True) if both the operands are having the value 1 (True); Otherwise, it will return 0 (False).
a) Bitwise AND (&) .
b) Bitwise OR (|)
c) Bitwise Exclusive OR(A)
d) None of these
Answer:
a) Bitwise AND (&)

Question 120.
………… will return 1 (True) if any one of the operands is having a value 1 (True); It returns 0 (False) if both the operands are having the value 0 (False)
a) Bitwise AND (&)
b) Bitwise OR (|)
c) Bitwise Exclusive OR(A)
d) None of these
Answer:
b) Bitwise OR (|)

Question 121.
…………. will return 1 (True) if only one of the operand is having a value 1 (True).If both are True or both are False, it will return 0 (False).
a) Bitwise AND (&)
b) Bitwise OR (|)
c) Bitwise Exclusive OR(A)
d) None of these
Answer:
c) Bitwise Exclusive OR(A)

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 122.
There are …………… bitwise shift operators in C++.
a) Three
b) Two
c) Four
d) Five
Answer:
b) Two

Question 123.
……………. is a type of * .wise shift operator in
C++.
a) Shift left
b) Shift right
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 124.
……………. is a type of bitwise shift left operator in C++.
a) <<
b) >>
c) &&
d) ||
Answer:
a) <<

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 125.
…………. is a type of bitwise shift right operator in C++.
a) <<
b) >>
c) &&
d) ||
Answer:
b) >>

Question 126.
The value of the left operand is moved to the left by the number of bits specified by the right operand using …………. operator.
a) <<
b) >>
c) &&
d) ||
Answer:
a) <<

Question 127.
The value of the left operand is moved to right by the number of bits specified by the right operand using …………. operator.
a) <<
b) >>
c) &&
d) ||
Answer:
b) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 128.
Right operand should be an unsigned integer for …………… operator.
a) Arithmetic
b) Relational
c) Bitwise Shift
d) None of these
Answer:
c) Bitwise Shift

Question 129.
………… is the bitwise one’s complement operator.
a) <<
b) >>
c) &&
d) ~
Answer:
d) ~

Question 130.
The bitwise ………….. operator inverts all the bits in a binary pattern, that is, all l’s become 0 and all 0’s become 1.
a) Shift left
b) Shift right
c) One’s complement
d) None of these
Answer:
c) One’s complement

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 131.
…………… is a unary operator.
a) Shift left
b) Shift right
c) Bitwise one’s complement
d) None of these
Answer:
c) Bitwise one’s complement

Question 132.
………….. operator is used to assigning a value to a variable which is on the left-hand side of an assignment statement.
a) Assignment
b) Logical
c) Bitwise
d) Conditional
Answer:
a) Assignment

Question 133.
…………. is commonly used as the assignment operator in all computer programming languages.
a) :=
b) ==
c) =
d) None of these
Answer:
c) =

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 134.
…………… operator copies the value at the right side of the operator to the left side variable,
a) Assignment
b) Logical
c) Bitwise
d) Conditional
Answer:
a) Assignment

Question 135.
The assignment operator is a(n) ……………….. operator.
a) Unary
b) Binary
c) Ternary
d) Conditional
Answer:
b) Binary

Question 136.
How many conditional operators are used in C++?
a) one
b) two
c) three
d) four
Answer:
a) one

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 137.
…………….. operator is a Ternary Operator.
a) Assignment
b) Logical
c) Bitwise
d) Conditional
Answer:
d) Conditional

Question 138.
…………… operator is used as an alternative to if … else control statement.
a) Assignment
b) Logical
c) Bitwise
d) Conditional
Answer:
d) Conditional

Question 139.
……………. is a pointer to a variable operator.
a) &
b) *
c) →
d) → *
Answer:
b) *

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 140.
…………… is an address operator.
a) &
b) *
c) →
d) →*
Answer:
a) &

Question 141.
……………. is a direct component selector operator.
a) .(dot)
b) *
c) →
d) →*
Answer:
a) .(dot)

Question 142.
…………… is an indirect component selector operator.
a) .(dot)
b) *
c) →
d) →*
Answer:
c) →

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 143.
…………. is a dereference operator.
a) . (dot)
b) .*
c) →
d) →*
Answer:
b) .*

Question 144.
……………… is a dereference pointer to class member operator.
a) . (dot)
b) .*
c) →
d) →*
Answer:
d) →*

Question 145.
……………. is a scope resolution operator.
a) .(dot)
b) .*
c) : :
d) →*
Answer:
c) : :

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 146.
The operands and the operators are grouped in a specific logical way for evaluation is called as………………
a) Operator precedence
b) Operator association
c) Hierarchy
d) None of these
Answer:
b) Operator association

Question 147.
Which operator is lower precedence?
a) Arithmetic
b) Logical
c) Relational
d) None of these
Answer:
b) Logical

Question 148.
Which operator is higher precedence?
a) Arithmetic
b) Logical
c) Relational
d) None of these
Answer:
a) Arithmetic

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 149.
Which operator is the lowest precedence?
a) Assignment
b) Comma
c) Conditional
d) Arithmetic
Answer:
b) Comma

Question 150.
In C++, asterisk ( * ) is used for ……………… purpose.
a) Multiplication
b) Pointer to a variable
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 151.
……………. punctuator indicates the start and the end of a block of code.
a) Curly bracket { }
b) Paranthesis ()
c) Sqaure bracket [ ]
d) Angle bracket < >
Answer:
a) Curly bracket { }

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 152.
……………. punctuator indicates function calls and function parameters.
a) Curly bracket { }
b) Paranthesis ()
c) Square bracket [ ]
d) Angle bracket < >
Answer:
b) Paranthesis ()

Question 153.
……………. punctuator indicates single and multidimensional arrays.
a) Curly bracket { }
b) Paranthesis ()
c) Square bracket [ ]
d) Angle bracket < >
Answer:
c) Square bracket [ ]

Question 154.
……………… punctuator is used as a separator in an expression.
a) Comma,
b) Semicolon;
c) Colon :
d) None of these
Answer:
a) Comma,

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 155.
Every executable statement in C++ should terminate with a ………..
a) Comma,
b) Semicolon;
c) Colon:
d) None of these
Answer:
b) Semicolon;

Question 156.
……………… punctuator is used to label a statement.
a) Comma,
b) Semicolon;
c) Colon:
d) None of these
Answer:
c) Colon:

Question 157.
………….. is a single line comment.
a) /I
b) /* ……..*/
c) \\
d) None of these
Answer:
a) /I

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 158.
……………… is a multi line comment.
a) //
b) /* */
c) \\
d) None of these
Answer:
b) /* */

Question 159.
C++ provides the operator to get input. .
a) >>
b) <<
c) ||
d) &&
Answer:
a) >>

Question 160.
…………….. operator extracts the value through the keyboard and assigns it to the variable on its right.
a) >>
b) <<
c) ||
d) &&
Answer:
a) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 161.
………………. operator is called as “Stream extraction” or “get from” operator.
a) >>
b) <<
c) ||
d) &&
Answer:
a) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 162.
Get from operator requires …………….. operands.
a) three
b) two
c) four
d) five
Answer:
b) two

Question 163.
…………….. is the operand of get from the operator.
a) Predefined identifier cin
b) Variable
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 164.
To receive or extract more than one value at a time ………… operator should be used for each variable.
a) >>
b) <<
c) ||
d) &&
Answer:
a) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 165.
……………. is called cascading of operator.
a) >>
b) <<
c) 11 .
d) Both A and B
Answer:
d) Both A and B

Question 166.
C++ provides …………… operator to perform output operation. a) >>
b) <<
c) ||
d) &&
Answer:
b) <<

Question 167.
The operator ………….. is called the “Stream insertion” or “put to” operator.
a) >>
b) <<
c) ||
d) &&
Answer:
b) <<

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 168.
…………… operator is used to send the strings or values of the variables on its right to the object on its left. a) >>
b) <<
c) ||
d) &&
Answer:
b) <<

Question 169.
The second operand of put to operator may be a …………….
a) Constant
b) Variable
c) Expression
d) Either A or B or C
Answer:
d) Either A or B or C

Question 170.
To send more than one value at a time …………… operator should be used for each constant/ variable/expression.
a) >>
b) <<
c) ||
d) &&
Answer:
a) >>

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 171.
The compiler ignores …………… statement.
a) Comment
b) Input
c) Output
d) Assignment
Answer:
a) Comment

Question 172.
Usually all C++ programs begin with include statements starting with a ……………… symbol.
a) $
b) #
c) {
d) %
Answer:
b) #

Question 173.
The symbol …………… is a directive for the preprocessor.
a) $
b) #
c) {
d) %
Answer:
b) #

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 174.
_____ means, statements are processed before the compilation process begins.
a) Preprocessor
b) Include
c) Header file
d) None of these
Answer:
a) Preprocessor

Question 175.
The header file ……………… should include in every C++ program to implement input/output functionalities.
a) iostream
b) stdio
c) conio
d) math
Answer:
a) iostream

Question 176.
………….. header file contains the definition of its member objects cin and cout.
a) iostream
b) stdio
c) conio
d) math
Answer:
a) iostream

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 177.
Namespace collects identifiers used for …………..
a) Class
b) Object
c) Variables
d) All the above
Answer:
d) All the above

Question 178.
…………….. provides a method of preventing name conflicts in large projects.
a) namespace
b) header files
c) include
d) None of these
Answer:
a) namespace

Question 179.
Every C++ program must have a …………… function.
a) user defined
b) main( )
c) Library .
d) None of these
Answer:
b) main( )

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 180.
The …………….. function is the starting point where all C++ programs begin their execution.
a) user-defined
b) main ( )
c) Library
d) None of these
Answer:
b) main ( )

Question 181.
The executable statements should be inside the ………… function.
a) user-defined
b) main ( )
c) Library
d) None of these
Answer:
b) main ( )

Question 182.
The statements between the …………… braces are executable statements.
a) Curly bracket { }
b) Paranthesis ()
c) Square bracket [ ]
d) Angle bracket < >
Answer:
a) Curly bracket { }

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 183.
For creating and executing a C++ program, one must follow ……………. important steps.
a) two
b) three
c) five
d) four
Answer:
d) four

Question 184.
For creating and executing a C++ program, one must follow ……….. step.
a) Creating source code and save with .cpp extension
b) Compilation
c) Execution
d) All the above
Answer:
d) All the above

Question 185.
………………. links the library files with the source code and verifies each and every line of code.
a) Interpreter
b) Compiler
c) Loader
d) Assembler
Answer:
b) Compiler

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 186.
If there are no errors in the source code, …………… translates the source code into a machine-readable object file.
a) Interpreter
b) Compiler
c) Loader
d) Assembler
Answer:
b) Compiler

Question 187.
The compiler translates the source code into machine-readable object file with an extension…………..
a) .cpp
b) .exe
c) .obj *
d) None of these
Answer:
c) .obj *

Question 188.
The object file becomes an executable file with extension ……………
a) .cpp
b) .exe
c) .obj
d) None of these
Answer:
b) .exe

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 189.
………….. files can run without the help of any compiler or IDE.
a) Source
b) Object
c) Executable
d) None of these
Answer:
c) Executable

Question 190.
…………… makes it easy to create, compile and execute a C++ program.
a) Editors
b) IDE
c) Compilers
d) None of these
Answer:
b) IDE

Question 191.
IDE stands for …………….
a) Integrated Development Environment
b) Integrated Design Environment
c) Instant Development Environment
d) Integral Development Environment
Answer:
a) Integrated Development Environment

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 192.
……………. is open-source C++ compiler.
a) Dev C++ / Geany / Sky IDE
b) Code Lite / Code::blocks / Eclipse
c) Ner Beans / Digital Mars
d) All the above
Answer:
d) All the above

Question 193.
Dev C++ is written in …………
a) Delphi
b) C++
c) C
d) Pascal
Answer:
a) Delphi

Question 194.
………….. error is possible in C++.
a) Syntax
b) Semantic
c) Run-time
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 195.
………….. error occurs because of some illegal operation that takes place.
a) Syntax
b) Semantic
c) Run-time
d) All the above
Answer:
c) Run-time

Question 196.
Semantic error is called as ……………error.
a) Syntax
b) Logic
c) Run-time
d) All the above
Answer:
b) Logic

Question 197.
If a program tries to open a file which does not exist, it results in a …………. error.
a) Syntax
b) Logic
c) Run-time
d) All the above
Answer:
c) Run-time

Question 198.
……………. errors occur when grammatical rules of C++are violated.
a) Syntax
b) Logic
c) Run-time
d) All the above
Answer:
a) Syntax

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Very Short Answers (2 Marks)

Question 1.
Mention any two benefits of C++.
Answer:

  1. C++ is a highly portable language and is often the language of choice for multi-device, multi-platform app development.
  2. C++ is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction, and encapsulation.

Question 2.
What is a character?
Answer:
A character represents any alphabet, number, or any other symbol (special characters) mostly available in the keyboard.

Question 3.
What are the types of C++ operators based on the number of operands?
Answer:
The types of C++ operators based on the number of operands are:

  1. Unary Operators – Require only one operand
  2. Binary Operators – Require two operands
  3. Ternary Operators – Require three operands

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What are the recent keywords included in C++?
Answer:
The recent list of keywords includes: using, namespace, bal, static_cast, const_cast, dynamic_cast, true, false.

Question 5.
What is a stream extraction operator?
Answer:
C++ provides the operator >> to get input. It extracts the value through the keyboard and assigns it to the variable on its right; hence, it is called as “Stream extraction” or “get from” operator.

Question 6.
Why the following identifiers are invalid?
a) num-add
b) this
c) 2myfile
Answer:
a) num-add – It contains spedal character (-) which ¡s not permitted
b) this – It is a keyword in C++. Keyword can not be used as identifier
c) 2myflle – Name must begin with an alphabet or an underscore.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7.
What are the main types of C++ datatypes?
Answer:
In C++, the data types are classified into three main categories

  1. Fundamental data types
  2. User-defined data types
  3. Derived data types.

Question 8.
What are Boolean literals?
Answer:
Boolean literals are used to represent one of the Boolean values (True or false). Internally true has value 1 and false has value 0.

Question 9.
What are string literals?
Answer:
The sequence of characters enclosed within double quotes is called String literals. By default, string literals are automatically added with a special character ‘\0’ (Null) at the end. Valid string Literals: “A” “Welcome” “1234” Invalid String Literals : ‘Welcome’,’1234′

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Differentiate Operators and Operands.
Answer:
The symbols which are used to do some mathematical or logical operations are called as Operators.
The data items or values that the operators act upon are called as Operands.

Question 11.
What are the classifications of C++ operators based on operand requirements?
Answer:
In C++, the operators are classified on the basis of the number of operands as follows:
i) Unary Operators – Require only one operand
ii) Binary Operators – Require two operands
iii) Ternary Operators – Require three operands

Question 12.
List the C++ operators.
Answer:
C++ Operators are classified as:

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators
  • Conditional Operator
  • Other Operators ,

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 13.
Write note on increment and decrement operators.
Answer:
++ (Plus, Plus) Increment operator
– (Minus, Minus) Decrement operator
An increment or decrement operator acts upon a single operand and returns a new value. Thus, these operators are unary operators. The increment operator adds 1 to its operand and the decrement operator subtracts 1 from its operand.
Example:
x++ is the same as x = x+1; It adds 1 to the present value of x.
X– is the same as x = x—1; It subtracts 1 from the present value of x.

Question 14.
Write a note on bitwise operators.
Answer:
Bitwise operators work on each bit of data and perform the bit-by-bit operation.
In C++, there are three kinds of bitwise operators, which are:

  • Logical bitwise operators
  • Bitwise shift operators
  • One’s compliment operator

Question 15.
Write about bitwise one’s compliment operator.
Answer:
The Bitwise one’s compliment operator:
The bitwise One’s compliment operator ~(Tilde), inverts all the bits in a binary pattern, that is, all l’s become 0 and all 0’s become 1. This is a unary operator.
Example:
If a = 15; Equivalent binary values of a is 0000 1111
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 4

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 16.
Write about assignment operator.
Answer:
Assignment Operator:
The assignment operator is used to assigning a value to a variable which is on the left-hand side of an assignment statement. = (equal to) is commonly used as the assignment operator in all computer programming languages. This operator copies the value at the right side of the operator to the left side variable. It is also a binary operator.
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 5

Question 17.
What are the shorthand assignment operators? Give example.
Answer:

Operator

      Name of  Operator                                                         Example
+= Addition Assignment a = 10;
c = a+= 5;
(ie, a = a+5)
c = 15
-= Subtraction Assignment a = 10;
c = a-= 5;
(ie, a = a-5)
c = 5
* = Multiplication Assignment a = 10;
c = a*= 5;
(ie, a = a*5)
c = 50
/= Division Assignment a = 10;
c – a/= 5;
(ie, a = a/5)
c = 2
%= Modulus Assignment a = 10;
c = a%= 5;
(ie, a = a%5)
c = 0

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 18.
Write note on conditional or ternary operator.
Answer:
In C++, there is only one conditional operator is used. ?: is a conditional Operator. This is a Ternary Operator. This operator is used as an alternative to if… else control statement.

Question 19.
Write note on comma (, ) operator.
Answer:
The comma (,) is an operator in C++ used to bring together several expressions. The group of expressions separated by a comma is evaluated from left to right.

Question 20.
What are the pointer operators?
Answer:
* – Pointer to a variable operator
& – Address of operator

Question 21.
What are the component selection operators?
Answer:
. – Direct component selector operator
-> – Indirect component selector operator

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 22.
What are the class member operators?
Answer:
:: – Scope access / resolution operator
.* – Dereference operator
->* – Dereference pointer to class member operator

Question 23.
What is operator association?
Answer:
The operands and the operators are grouped in a specific logical way for evaluation. This logical grouping is called as an Association.

Question 24.
What are the cascading operators?
Answer:
Get from (>>) and Put to (<<) operators are cascading operators.

Question 25.
What are the popular C++ Compilers with IDE.
Answer:

Compiler

Availability

Dev C++ Open-source
Geany Open-source
Code:: blocks Open source
Code Lite Open-source
Net Beans Open-source
Digital Mars Open-source
Sky IDE Open-source
Eclipse Open-source

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Short Answers (3 Marks)

Question 1.
What are the benefits of C++?
Answer:
Benefits of learning C++:

  • c++ ¡s a highly portable language and ¡s often the language of choice for multi-device, multi- platform app development.
  • C++ is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction and encapsulation.
  • C++ has a rich function library.
  • C++ allows exception handling, inheritance and function overloading which are not possible in C.
  • C++ is a powerful, efficient and fast language.

It finds a wide range of applications — from GUI applications to 3D graphics for games to real-time mathematical simulations.

Question 2.
What are the characters used In C++?
Answer:
C++ accepts the following characters:

Alphabets A …. Z, a…. z
Numeric 0 …. 9
Special Characters + – * / ~ ! @ # $ % A& [ ] ( ) {} = ><_\l?.,:'”;
White space Blank space, Horizontal tab (->), Carriage return (), Newline, Form feed
Other characters C++ can process any of the 256 ASCII characters as data.

Question 3.
What are Automatic conversion and Type promotion?
Answer:
Implicit type conversion is a conversion performed by the compiler automatically. So, the implicit conversion is also called “Automatic conversion”. This type of conversion is applied usually whenever different data types are intermixed in an expression. If the type of the operands differs, the compiler converts one of them to match with the other, using the rule that the “smaller” type is converted to the “wider” type, which is called “Type Promotion”.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What are the rules for naming an identifier/variable?
Answer:
Rules for naming an identifier:

  • The first character of an identifier must be an alphabet or an underscore (-).
  • Only alphabets, digits, and underscore are permitted. Other special characters are not allowed as part of an identifier.
  • c++ is case sensitive as it treats upper and lower-case characters differently.
  • Reserved words or keywords cannot be used as an identifier name.

Question 5.
List the kinds of literals in C++.
Answer:
C++ has several kinds of literals. They are:
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 6

Question 6.
What are the types of C++operators?
Answer:
C++ Operators are classified as:

  1. Arithmetic Operators
  2. Relational Operators
  3. Logical Operators
  4. Bitwise Operators
  5. Assignment Operators
  6. Conditional Operator
  7. Other Operators

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7.
Write a note on character constants.
Answer:
A character constant is any valid single character enclosed within single quotes. A character constant in C++ must contain one character and must be enclosed within a single quote.
Valid character constants : ‘A’, ‘2\ ‘$’
Invalid character constants : “A”
The value of a single character constant has an equivalent ASCII value. For example, the value of’A’ is 65.

Question 8.
What are escape sequences? Explain.
Answer:
Escape sequences (or) Non-graphic characters:
C++ allows certain non-printable characters represented as character constants. Non-printable characters are also called non-graphical characters. Non-printable characters are those characters that cannot be typed directly from a keyboard during the execution of a program in C++.
For example: backspace, tabs etc. These non-printable characters can be represented by using escape sequences. An escape sequence is represented by a backslash followed by one or two characters.
Example: \t \On \xHn

Question 9.
Tabulate the escape sequence characters.
Answer:

Escape sequence

Non-graphical character

\a Audible or alert bell
\b Backspace
\f Form feed
\n Newline or linefeed
\r Carriage return
\t Horizontal tab
\v Vertical tab
\\ Backslash
\’ Single quote
\” Double quote
\? Question Mark
\On Octal number
\xHn Hexadecimal number
\o Null

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Write a note on arithmetic operators.
Answer:
Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.

Operator

Operation

Example

+ Addition 10 + 5 = 15
Subtraction 10 – 5 = 5
* Multiplication 10 * 5 = 50
/ Division 10 / 5 = 2 (Quotient of the division)
% Modulus (To find the reminder of a division) 10 % 3 = 1 (Remainder of the division)

Question 11.
What are the relational operators in C++? Give examples.
Answer:
Relational operators are used to determining the relationship between its operands. When the relational operators are applied on two operands, the result will be a Boolean value i.e 1 or 0 to represents True or False respectively. C++ provides six relational operators. They are:

Operator Operation Example
> Greater than a > b
< Less than a < b
>= Greater than or equal to a >= b
<= Less than or equal to a <= b
== Equal to a == b
j= Not equal a != b
  • In the above examples, the operand ‘a’ is compared with ‘b’ and depending on the relation, the result will be either 1 or 0. i.e., 1 for true, 0 for false.
  • All six relational operators are binary operators.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 12.
What are the logical operators used in C++? Explain its operation.
Answer:
A logical operator is used to evaluate logical and relational expressions. The logical operators act upon the operands that are themselves called as logical expressions. C++ provides three logical operators.
table

Operator

Operation

Description

&& AND The logical AND combines two different relational expressions into one. It returns 1 (True), if both expressions are true, otherwise, it returns 0 (False).
II OR The logical OR combines two different relational expressions into one. It returns 1 (True) if either one of the expressions is true. It returns 0 (False) if both the expressions are false.
! NOT NOT works on a single expression/operand. It simply negates or inverts the truth value, i.e., if an operand/expression is 1 (True) then this operator returns 0 (False) and vice versa.

AND, OR both are binary operators where as NOT is a unary operator.
Example:
a = 5, b = 6, c = 7;

Expression

Result

(a<b) && (b<c) 1 (True)
(a>b) && (b<c) 0 (False)
(a<b) || (b>c) 1 (True)
!(a>b) 1 (True)

Question 13.
What are the logical bitwise operators? Explain its operation.
Answer:
Logical bitwise operators:

  • & Bitwise AND (Binary AND)
  • | Bitwise OR (Binary OR)
  • ∧ Bitwise Exclusive OR (Binary XOR)
  • Bitwise AND (&) will return 1 (True)if both the operands are having the value 1 (True); Otherwise, it will return 0 (False).
  • Bitwise OR (|) will return 1 (True) if any one of the operands is having a value 1 (True); It returns 0 (False) if both the operands are having the value 0 (False).
  • Bitwise XOR(A) will return 1 (True) if only one of the operand is having a value of 1 (True). If both are True or both are False, it will return 0 (False).

The truth table for bitwise operators (AND, OR, XOR)

A B A & B A | B A ∧ B
1 1 1 1 0
1 0 0 1 1
0 1 0 1 1
0 0 0 0 0

Example:
If a = 65, b=15
Equivalent binary values of 65 = 0100 0001; 15 = 0000 1111
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 7

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 14.
What are the bitwise shift operators? Explain its operation.
Answer:
The Bitwise shift operators:
There are two bitwise shift operators in C++, Shift left (<<) and Shift right (>>).

  1. Shift left (<<) – The value of the left operand is moved to the left by the number of bits specified by the right operand. The right operand should be an unsigned integer.
  2. Shift right (>>) – The value of the left operand is moved to the right by the number of bits specified by the right operand. The right operand should be an unsigned integer.

Example:
If a =15; the Equivalent binary value of a is 0000 1111
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 8

Question 15.
What is input operator in C++? Explain.
Answer:
C++ provides the operator >> to get input. It extracts the value through the keyboard and
assigns it to the variable on its right; hence, it is called as “Stream extraction” or “get from” operator.
It is a binary operator i.e., it requires two operands. The first operand is the pre-defined identifier cin that identifies keyboard as the input device. The second operand must be a variable.
Working process of cin
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 9
Example:
cin>>num; — Extracts num value
cin>>x>>y; — Extracts x and y values

Question 16.
What is an output operator in C++? Explain.
Answer:
C+ + provides << operator to perform output operation. The operator << is called the “Stream insertion” or “put to” operator. It is used to send the strings or values of the variables on its right to the object on its left. << is a binary operator.
The first operand is the pre-defined identifier cout that identifies monitor as the standard output object. The second operand may be a
constant, variable or an expression.
Working process of cout
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 10
Example:
cout<<“Welcome”; – Display Welcome on-screen cout<<“The Sum =”<

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Explain in Detail 5 Marks

Question 1.
Explain Integer Constants. (or) Fixed point constants In detail.
Answer:
Integers are whole numbers without any fractions. An integer constant must have at least one digit without a decimal point. It may be signed or unsigned. Signed integers are considered as negative, commas and blank spaces are not allowed as part of it.
In C++, there are three types of integer constants:

  • Decimal
  • Octal
  • Hexadecimal

i) Decimal
Any sequence of one or more digits (0 …. 9).

Valid

Invalid

725 7,500 (Comma is not allowed)
-27 66 5 (Blank space is not allowed)
4.56 9$ (Special Character not allowed)

If we assign 4.56 as an integer decimal constant, the compiler will accept only the integer portion of 4.56 ie. 4. It will simply ignore .56.

ii) Octal:
Any sequence of one or more octal values (0 ….7) that begins with 0 is considered as an Octal constant.

Valid

Invalid

012 05,600 (Comma is not allowed)
-027 04.56 (A decimal point is not allowed)**
+0231 0158 (8 is not a permissible digit in the octal system)

iii) Hexadecimal:
Any sequence of one or more Hexadecimal values (0 …. 9, A …. F) that starts with Ox or OX is considered as a Hexadecimal constant.

Valid

Invalid

0x123 0x1,A5 (Comma is not allowed)
0X568 0x.l4E (Decimal point is not allowed like this)

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 2.
Explain Real Constants. (or) Floating-point constants in detail.
Answer:
Real Constants (or) Floating-point constants:
A real or floating-point constant is a numeric constant having a fractional component. These constants may be written ¡n fractional form or ¡n exponent form.
The fractional form of a real constant is a signed or unsigned sequence of digits including a decimal point between the digits.
It must have at least one digit before and after a decimal point. It may have a prefix with the + or – sign.
A real constant without any sign will be considered positive.
Exponent form of real constants consists of two parts:

  1. Mantissa
  2. Exponent

The mantissa must be either an integer or a real constant. The mantissa followed by a letter E or e and the exponent. The exponent should also be an integer.
For Example:
58000000.00 may be written as 0.58 x 108 or 0. 58E8.

Mantissa (Before E)

Exponent (After E)

0.58 8

Example:
5.864 E1 → 5.864 x 101 → 58.64
5864 E-2 → 5864 x 10-2 → 58.64
0.5864 E2 → 0.5864 x 102 → 58.64

Question 3.
Explain the prefix and postfix operators’ working process with suitable examples.
Answer:
The ++ or – operators can be placed either as prefix (before) or as postfix (after) to a variable. With the prefix version, C++ performs the increment / decrement before using the operand.
For example: N1=10, N2=20;
S = ++N1 + ++N2;
The following Figure explains the working process of the above statement.
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 11
In the above example, the value of num is first incremented by 1, then the incremented value is assigned to the respective operand.
With the postfix version, C++ uses the value of the operand in evaluating the expression before incrementing /decrementing its present value.
For example: N1=10, N2=20;
S = N1++ + ++N2;
The following Figure explains the working process of the above statement.
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 12
In the above example, the value assigned to operand N1 is taken into consideration, first and then the value will be incremented by 1.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What are punctuators/separators? List the punctuators and their operations.
Answer:
Punctuators are symbols, which are used as delimiters while constructing a C++ program. They are also called “Separators”. The following punctuators are used in C++.

Curly braces { } Opening and closing curly braces indicate the start and the end of a block of code. A block of code containing more than one executable statement. These statements together are called as “compound statement”. int main ()
{int x=10,
y=20, sum;
sum = x + y;
cout << sum;
}
Parenthesis () Opening and closing parenthesis indicate function calls and function parameters. clrscr();
add (5, 6);
Square brackets [ ] It indicates single and multidimensional arrays. int num[5];
charname[50];
Comma (,) It is used as a separator in an expression. int x=10, y=20, sum;
Semicolon ; Every executable statement in C++ should terminate with a semicolon. int main ()

{
int x=10, y=20, sum; sum = x + y; cout << sum; }

Colon : It is used to label a statement. private:
Comments
///* *1
Any statement that begins with // are considered a comments. Comments are simply ignored by compilers, i.e., compiler does not execute any statement that begins
with a // // Single line comment
/*  ………….. /  Multiline comment
/* This is written By
myself to learn CPP */ int main ()
{
intx=10,
y=20, sum;  // to sum x  and y  sum = x + y;
cout << sum;
}

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Evaluate Yourself

Question 1.
What is meant by literals? How many types of integer literals available in C++?
Answer:
Literals are data items whose values do not change during the execution of a program. Literals are called as Constants.
In C++, there are three types of integer literals (constants). They are:

  1. Decimal
  2. Octal
  3. Hexadecimal

Question 2.
What kind of constants is following?
i) 26
ii) 015
iii) 0xF
iv) 014.9
Answer:
i) 26 : Decimal constant
ii) 015 : Octal constant
iii) 0xF : Hexadecimal constant
iv) 014.9 : Integer Constant. (A fractional number that begins with 0, C++ has consider the number as an integer not an Octal)

Question 3.
What is the character constant in C++?
Answer:
A character constant is any valid single character enclosed within single quotes. A character constant in C++ must contain one character and must be enclosed within a single quote.
Valid character constants: ‘A’, ‘2’, ‘$’
Invalid character constants: “A”

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
How are non-graphic characters represented in C++?
Answer:
Non-printable characters are also called as non-graphical characters.
Non-printable characters are those characters that cannot be typed directly from a keyboard during the execution of a program in C++, for example, backspace, tabs, etc. These non-printable characters can be represented by using escape sequences.

An escape sequence is represented by a backslash followed by one or two characters.

Escape Sequence

Non-graphical character

\a The audible or alert bell
\b Backspace
\f Form feed
\n Newline or linefeed
\r Carriage return
\t Horizontal tab
\v Vertical tab
\\ Backslash
V Single quote
\” Double quote
\On Octal number
\xHn Hexadecimal number
\0 Null

Even though an escape sequence contains two characters, they should be enclosed within single quotes because, C++ consider escape sequences as character constants and allocates one byte in ASCII representation.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 5.
Write the following real constants into exponent form:
i) 32.179
ii) 8.124
iii) 0.00007
Answer:
i) 32.179 → 3.2179E1 (OR) 0.32179E2 (OR) 32178E-3
ii) 8.124 → 0.8124E1 (OR) 8124E-3
iii) 0.00007 → 7E-5

Question 6.
Write the following real constants into fractional form:
i) 0.23E4
ii) 0.517E-3
iii) 0.5E-5
Answer:
i) 0.23E4 → 2300
ii) 0.517E-3 → 0.000517
iii) 0.5E-5 → 0.000005

Question 7.
What is the significance of the null (\0) character in a string?
Answer:
By default, string literals are automatically added with a special character ‘\0’ (Null) at the end. It is called as an end of string character.
The string “welcome” will actually be represented as “welcome\0” in memory and the size of this string is not 7 but 8 characters i.e., inclusive of the last character \0.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Evaluate Yourself

Question 1.
What is the use of operators?
Answer:
Operators are the symbols which are used to do some mathematical or logical operations on their operands.

Question 2.
What are binary operators? Give examples.
Answer:
Arithmetic binary operators.
Binary Operators – Require two operands.
The arithmetic operators addition(+), subtraction(-), multiplication(*), division(/) and Modulus(%) are binary operators which requires two operands.
Example:

Operator

Operation

Example

+ Addition 10 + 5 = 15
Subtraction 10 – 5 = 5 Slfil.r
* Multiplication 10 * 5 = 50
/ Division 10 / 5 = 2 (Quotient of the division)
% Modulus (To find the reminder of a division) 10 % 3 = 1 (Remainder of the division)

Question 3.
What does the modulus operator % do?
Answer:
The modulus operator is used to find the remainder of a division.
Example:
10%3 will return 1 which is the remainder of the division.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What will be the result of 8.5 % 2?
Answer:
The following error will appear while compiling the program.
Invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’.
The reason is % operator operates on integer operands only.

Question 5.
Assume that R starts with a value of 35. What will be the value of S from the following expression? S=(R–)+(++R)
Answer:
S = 70

Question 6.
What will be the value of j = – – k + 2k. if k is ‘ 20 initially?
Answer:
The value of j will be 57 and k will be 19.
C++ Code;
#include
using namespace std;
int main()
{
int k=20,j;
j=–k+2*k;
cout<< “Vlaue of j=”<<j<< “\nVlaue of
k =”<<k;
return 0;
}
Out put
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 13

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7.
What will be the value of p = p * ++j where j is 22 and p = 3 initially?
Answer:
The value of p is 69 and j is 23.
C++ program:
#include
using namespace std;
int main()
{
int j=22, p=3;
P = P * ++j;
cout<< “Value of p =”<<p<< “\nValue of
j =”<<j;
return 0;
}
Out put
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 14

Question 8.
Give that i = 8, j = 10, k = 8, What will be result of the following expressions?
i) i < k
ii) i < j
iii) i > = k
iv) i = = j
v) j ! = k
Answer:

Expression

Result

i < k 0 (False)
i < j 1 (True)
i >= k 1 (True)
i == j 0 (False)
j != k 1 (True)

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 9.
What will be the order of evaluation for the following expressions?
i) i + 3 > = j – 9
ii) a +10 < p – 3 + 2 q
Answer:
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 15

Question 10.
Write an expression involving a logical operator to test, if marks are 75 and grade is ‘A’.
Answer:
(marks == 75) && (grade == ‘A)

Hands On Practice

Type the following C++ Programs in Dev C++ IDE and execute, if the compiler shows any errors, try to rectify it and execute again and again till you get the expected result.
Question 1.
C++ Program to find the total marks of three
subjects.
#include
using namespace std;
int main()
{
int m1, m2, m3, sum;
cout << “\n Enter Mark 1:”; cin >> m1;
cout << ”\n Enter Mark 2: “; cin >> m2;
cout << “\n Enter Mark 3: “; cin >> m3;
sum = m1 + m2 + m3;
cout << “\n The sum = ” << sum;
}
Make changes in the above code to get the average of all the given marks.
Answer:
Modified Program:
#include
using namespace std;
int main()
{
int m1, m2, m3, sum;
float avg;
cout << “\n Enter Mark 1: “;
cin >> m1;
cout << “\n Enter Mark 2: “;
cin >> m2;
cout << “\n Enter Mark 3: “;
cin >> m3;
sum = m1 + m2 + m3;
avg = (float)sum / 3;
cout << “\n The sum = ” << sum;
cout << “\n The average = ” << avg;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 16

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 2.
C++ program to find the area of a circle.
#include
using namespace std;
int main()
{
int radius;
float area;
cout << “\n Enter Radius: “;
cin<< radius;
area = 3.14 * radius * radius;
cout << “\n The area of circle =“ <<area;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 17

Question 3.
Point out the errors in the following program:
Using namespace std;
int main( )
{
cout << “Enter a value”
cin << numl >> num2
num+num2=sum;
cout >> “\n The Sum= ” >> sum;
Answer:

Given code

Error

Using namespace std; The keyword must be in lowercase. So, Using should be written as using. Header file is missing.
int main() No Error
No Error
cout << “Enter a value “; Prompt should be “Enter two values” because cin contains two variables.
cin << numl >> num2 Variables are not declared. It should be declared first, cin must followed by Extraction operator(>>).

Semicolon is missing at the end of the statement.

num+num2=sum; Improper assignment statement and undefined variable name used. It should be replaced as sum=numl + num2;
cout >> “\n The Sum= ” >> sum; cout must followed by put to the operator.
Return 0; statement is missing. Close bracket} missing.

The correct program is given below:
using namespace std;
#include
int main()
{
int num1,num2,sum;
cout << “Enter two values”; cin >> numl >> num2;
sum= num+num2;
cout << “\n The Sum= “<< sum;
return 0;
}

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
Point out the type of error in the following program:
#include
using namespace std;
int main()
{
int h=10; w=12;
cout << “Area of rectangle ” << h+w; >
Answer:
Syntax error exists. Ie. int h=10;w=12; should written as int h=10,w=12;
There is also a logical error in the above program.
The formula for rectangle area is given wrong. This error will not indicate by the compiler.
MODIFIED PROGRAM:
#include
using namespace std;
int main()
{
int h=10, w=12;
cout << “Area of rectangle ” << h*w;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 18

DATATYPES, VARIABLES AND EXPRESSIONS
Book Evaluation
Part -I

Choose The Correct Answer

Question 1.
How many categories of data types available in C++?
a) 5
b) 4
c) 3
d) 2
Answer:
c) 3

Question 2.
Which of the following data types is not a fundamental type?
a) signed
b) int
c) float
d) char
Answer:
a) signed

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
What will be the result of following statement?
char ch= ‘B’;
cout << (int) ch;
a) B
b) b
c) 65
d) 66
Answer:
d) 66

Question 4.
Which of the character is used as suffix to indicate a floating point value?
a) F
b) C
c) L
d) D
Answer:
a) F

Question 5.
How many bytes of memory allocates for the following variable declaration if you are using Dev C++? short int x;
a) 2
b) 4
c) 6
d) 8
Answer:
a) 2

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 6.
What is the output of the following snippet?
char ch = ‘A’;
ch= ch + 1;
a) B
b) A1
c) F
d) 1A
Answer:
a) B

Question 7.
Which of the following Is not a data type modifier?
a) signed
b) int
c) long
d) short
Answer:
b) int

Question 8.
Which of the following operator returns the size of the data type?
a) size of( )
b) int ( )
c) long ( )
d) double ( )
Answer:
a) size of( )

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 9.
Which operator to be used to access a reference of a variable?
a) $
b) #
c) &
d) !
Answer:
c) &

Question 10.
This can be used as an alternate to end command:
a) \t
b) \b
c) \0
d) \n
Answer:
c) \0

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Part II

Very Short Answers

Question 1.
Write a short note const keyword with an example.
Answer:
const is the keyword used to declare a constant, const keyword modifies/restricts the accessibility of a variable. So, it is known as an Access modifier.
Example:
const int num =100; indicates that the variable num can not be modified. It remains constant.

Question 2.
What is the use of setw( ) format manipulator?
Answer:
setw ( ):
setw manipulator sets the width of the field assigned for the output. The field width determines the minimum number of characters to be written in the output.
Syntax:
setw(number of characters)
Example:
cout << setw(25) << “Net Pay : ” << setw(10)
<< np << endl;

Question 3.
Why is char often treated as an integer data type?
Answer:
Character data type is often said to be an integer type since all the characters are represented in memory by their associated ASCII Codes.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What is a reference variable? What is its use?
Answer:
A reference provides an alias for a previously defined variable. Declaration of a reference consists of base type and an & (ampersand) symbol; reference variable name is assigned the value of a previously declared variable.
Syntax:
<&reference_variable> =
Example:
#include
using namespace std;
int main( )
{
int num;
int &temp = num; //declaration of a reference variable temp
num = 100;
cout << “\n The value of num =” << num;
cout << “\n The value of temp =” << temp;
}
Output
The value of num = 100
The value of temp = 100

Question 5.
ConsIder the following C++ statement Are they equivalent?
char ch=67;
char ch=’C’;
Answer:
Yes. Both are equivalent. Both assignment statements will store character C’ in the variable ch.

Question 6.
what Is the difference between 561 and 56?
Answer:

  • 56 indIcate an Integer
  • 56L indicates Long Integer The suffix L indicates Long. So it stores a long integer

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7.
Determine which of the following are valid constant? And specify their type,
i) 0.5
ii) ‘Name’
iii) ‘\t’
iv) 27,822
Answer:
i) 0.5 : Valid. Floating-point constant
ii) ‘Name’ : Invalid. String constant must be enclosed within double-quotes.
iii) ‘\t’ : Valid. Character constant.
iv) 27,822 : Invalid. Comma not allowed with integer constant.

Question 8.
Suppose x and y are two double-type variables that you want add as integers and assign to an integer variable. Construct a C++ statement for doing so.
Answer:
double x, y;
int sum;
x = 12.64;
y = 13.56;
sum = (int) x + (int) y;
The variable sum will have the value of 25 due to explicit casting.

Question 9.
What will be the result of following if num=6 initially?
Answer:
a) cout << num;
6
b) cout << (num==5);
0

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Which of the following two statements are valid? Why? Also write their result, int a;
i) a=3,014;
ii) a =(3,014);
Answer:
i) a=3,014; – Invalid. Special character comma(,) not allowed.
ii) a=(3,014); – Valid. 014 is an octal constant. It will be converted into decimal and then stored in a. So, a will hold 12 as its value.

Part – III

Short Answers

Question 1.
What are arithmetic operators in C++? Differentiate unary and binary arithmetic operators. Give example for each of them.
Answer:
Arithmetic Operators:
Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division, etc.

Operator Operation Example
+ Addition 10 + 5-15
 – Subtraction 10-5-5
* Multiplication 10 * 5 = 50
/ Division 10 / 5 = 2 (Quotient of the division)
% Modulus (To find the reminder of a division) 10 % 3 = 1 (Remainder of the division)

The above-mentioned arithmetic operators are binary operators which require a minimum of two operands.

Unary arithmetic operators:
– (Unary) – The unary minus operator changes the sign of its argument. A positive number ‘ becomes negative and negative number becomes
positive, int a = 5;
a = -a; // a becomes -5
+ (Unary) – The unary plus operator keeps the sign of its argument,
int a = -5;
a = +a; // a still have the value same value -5
(No change)
a = 5;
a = +a; // a stil have the same value 5
(No change)
Unary Minus is different from – (Binary) ie. subtraction operator requires two operands.
Unary Plus is different from + (Binary) ie. addition operator requires two operands.
#include
mt mamo
{
mt x=10;
intÿ= -10;
inta = -10;
‘nt b = 10;
y=+y;
a= -a;
b=+b;
cout«”\nx = “«X;
cout«”\ny = “«y;
cout«”\na = “«a;
cout«”\nb = “«b;
return 0;
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 19

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 2.
Evaluate x+= x + ++x; Let x=5;
Answer:
x=18
Code:
using namespace std;
#include
int main ()
{

int x;
x = 5;
x+= x + ++x;
cout «x;
return O;
}
Out put
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 20

Question 3.
How relational operators and logical operators related to one another?
Answer:
Both relational and logical operators will give the evaluation result as Boolean constant value 1 (True) or 0(False).

Question 4.
Evaluate the following C++ expressions where x, y, z are integers and m, n are floating
point numbers. The value of x = 5, y = 4 and
m=2.5;
i) n=x+y/x;
n=5
ii)z=m*x+y;
z=16
iii) z = (x++) * m + X;
z = 18
Code:
using namespace std;
#include
int main()
{
int x,y,z1,z2;
float m,n;
x=5;
y=4;
m=2.5;
n = x + y / X;
z1=m*x+y;
z2 = (x++) * m + X;
cout<<”\nN = “<<n;
còut<<”\nzl =<<z1;
cout<<”\nz2 =<<z2;
return 0;
}
output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 21

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

11th Computer Science Guide Introduction to C++ Additional Questions and Answers

Choose The Correct Answer 1 Mark

Question 1.
Every programming language has _____ fundamental element.
a) Data types
b) Variables
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 2.
c++ provides a predefined set of data types for handling the data item is known as …………….. data type.
a) Fundamental
b) Built-in data types
c) User-defined
d) Either A or B
Answer:
d) Either A or B

Question 3.
A programmer can create his own data types called as ______ data types.
a) Fundamental
b) Built-in data types
c) User defined
d) Either A or B
Answer:
c) User defined

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
In a programming language, fields are referred as ……………
a) Variables
b) Data
c) File
d) None of these
Answer:
a) Variables

Question 5.
In a programming language, values are referred to as ……………
a) Variables
b) Data
c) File
d) None of these
Answer:
b) Data

Question 6.
In C++, the data types are classified as ______ main categories.
a) three
b) four
c) two
d) five
Answer:
a) three

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 7.
In C++, ______ is a data type category.
a) Fundamental
b) Derived
c) User defined
d) All the above
Answer:
d) All the above

Question 8.
The ………….. are the named memory locations to hold values of specific data types.
a) Literals
b) Variables
c) Constants
d) None of these
Answer:
b) Variables

Question 9.
There are ………….. fundamental (atomic) data types in C++.
a) two
b) three
c) four
d) five
Answer:
d) five

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
…………… is an atomic data type in C++,
a) char / int
b) float / double
c) void
d) All the above
Answer:
d) All the above

Question 11.
………….. are whole numbers without any fraction.
a) Integers
b) Characters
c) Strings
d) None of these
Answer:
a) Integers

Question 12.
Identify the correct statement from the ; following.
a) Integers can be positive or negative.
b) If you try to store a fractional value in an int type variable it will accept only the integer portion of the fractional value.
c) If a variable is declared as an int, C++ compiler allows storing only integer values into it.
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 13.
……….. data type accepts and returns all valid \ ASCII characters.
a) Character
b) float
c) void
d) None of these
Answer:
a) Character

Question 14.
Character data type is often said to be an …………… type.
a) float
b) string
c) void
d) int
Answer:
d) int

Question 15.
……………… means significant numbers after decimal point.
a) Precision
b) Digit
c) Floating point
d) None of these
Answer:
a) Precision

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 16.
The _____ data type is larger and slower than type float.
a) Char
b) double
c) void
d) int
Answer:
b) double

Question 17.
The literal meaning for void is …………….
a) Empty space
b) Nothing
c) Blank
d) None of these
Answer:
a) Empty space

Question 18.
In C++, the ……………. data type specifies an empty set of values.
a) Char
b) double
c) void
d) int
Answer:
c) void

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 19.
……………. is used as a return type for functions that do not return any value.
a) Char
b) double
c) void
d) int
Answer:
c) void

Question 20.
Identify the correct statement from the following.
a) One of the most important reason for declaring a variable as a particular data type is to allocate appropriate space in memory.
b) As per the stored program concept, every data should be accommodated in the main memory before they are processed)
c) C++ compiler allocates specific memory space for each and every data handled according to the compiler’s standards.
d) All the above
Answer:
d) All the above

Question 21.
char data type needs ……………. bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
d) 1

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 22.
int data type needs ………….. bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
c) 2

Question 23.
float data type needs …………….. bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
b) 4

Question 24.
double data type needs ………… bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
a) 8

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 25.
The range of char data type is ………………
a) -127 to 128
b) -32,768 to 32,767
c) 3.4 x 10-38 to 3.4 x 1038 -1
d) 1.7 x 10-308 to 1.7 x 10308 -1
Answer:
a) -127 to 128

Question 26.
The range of int data type is …………..
a) -127 to 128
b) -32,768 to 32,767
c) 3.4 x HT38 to 3.4 x 1038-1
d) 1.7 x 10-308 to 1.7 x 10308 -1
Answer:
b) -32,768 to 32,767

Question 27.
The range of float data type is ……………
a) -127 to 128
b) -32,768 to 32,767
c) 3.4 x 10-38 to 3.4 x 1038 -1
d) 1.7 x lO”308 to 1.7 x 10308 -1
Answer:
c) 3.4 x 10-38 to 3.4 x 1038 -1

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 28.
The range of double data type is …………….
a) -127 to 128
b) -32,768 to 32,767
c) 3.4 x 10″38 to 3.4 x 1038-1
d) 1.7 x 10-308 to 1.7 x 10308 -1
Answer:
d) 1.7 x 10-308 to 1.7 x 10308 -1

Question 29.
…………….. can be used to expand or reduce the memory allocation of any fundamental data type.
a) Modifiers
b) Access specifiers
c) Promoters
d) None of these
Answer:
a) Modifiers

Question 30.
………….. are called as Qualifiers.
a) Modifiers
b) Access specifiers
c) Promoters
d) None of these
Answer:
a) Modifiers

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 31.
There are …………….modifiers used in C++.
a) five
b) four
c) three
d) two
Answer:
b) four

Question 32.
……………… is a modifier in C++,
a) signed / unsigned
b) long
c) short
d) All the above
Answer:
d) All the above

Question 33.
short data type needs …………. bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
c) 2

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 34.
unsigned short data type needs ………….. bytes of memory. .
a) 8
b) 4
c) 2
d) 1
Answer:
c) 2

Question 35.
signed short data type needs…………… bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
c) 2

Question 36.
signed long data type needs ……………. bytes of memory.
a) 8
b) 4
c) 2
d) 1
Answer:
b) 4

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 37.
The range of unsigned short is …………..
a) -32,768 to 32768
b) 0 to 65535
c) -2,147,483,648 to 2,147,483,647
d) 0 to 4,294,967,295
Answer:
b) 0 to 65535

Question 38.
The range of unsigned long is ……………..
a) -32,768 to 32768
b) 0 to 65535
c) -2,147,483,648 to 2,147,483,647
d) 0 to 4,294,967,295
Answer:
d) 0 to 4,294,967,295

Question 39.
The range of signed long is ……………..
a) -32,768 to 32768
b) 0 to 65535
c) -2,147,483,648 to 2,147,483,647
d) 0 to 4,294,967,295
Answer:
c) -2,147,483,648 to 2,147,483,647

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 40.
The range of unsigned char is …………….
a) -32,768 to 32768
b) 0 to 65535
c) 0 to 255
d) 0 to 4,294,967,295
Answer:
c) 0 to 255

Question 41.
The range of long double data type is ……………..
a) -127 to 128
b) -32,768 to 32,767
c) 3.4 x 10^932 to 1.1 x 104932 -1
d) 1.7 x 10~308 to 1.7 x 10308 -1
Answer:
c) 3.4 x 10^932 to 1.1 x 104932 -1

Question 42.
int data type needs …………. bytes of memory in Dec C++.
a) 8
b) 4
c) 2
d) 1
Answer:
b) 4

Question 43.
unsigned int data type needs ……………… bytes of memory in Dec C++.
a) 8
b) 4
c) 2
d) 1
Answer:
b) 4

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 44.
signed int data type needs …………… bytes of memory in Dec C++.
a) 8
b) 4
c) 2
d) 1
Answer:
b) 4

Question 45.
long double data type needs…………… memory in Dec C++.
a) 10
b) 8
c) 2
d) 12
Answer:
d) 12

Question 46.
long double data type needs…………… memory in Turbo C++.
a) 10
b) 8
c) 2
d) 12
Answer:
a) 10

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 47.
…………….. is an operator which gives the size of a data type.
a) sizeof()
b) byteof()
c) datatype()
d) None of these
Answer:
a) sizeof()

Question 48.
The suffix……………. is used for floating point values
a) U
b) L
C) F
d) None of these
Answer:
C) F

Question 49.
The suffix ……………… is used for long int values.
a) U
b) L
C) F
d) None of these
Answer:
b) L

Question 50.
The suffix ………….. is used for unsigned int
a) U
b) L
C) F
d) None of these
Answer:
a) U

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 51.
……………… are user-defined names assigned to specific memory locations in which the values are stored.
a) Literals
b) Variables
c) Operators
d) None of these
Answer:
b) Variables

Question 52.
There are ………….. values associated with a symbolic variable
a) two
b) three
c) four
d) five
Answer:
a) two

Question 53.
…………… is data stored in a memory location.
a) L-value
b) R-value
c) T-value
d) B-value
Answer:
b) R-value

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 54.
…………… is the memory address in which the R-value is stored.
a) L-value
b) R-value
c) T-value
d) B-value
Answer:
a) L-value

Question 55.
The memory addresses are in the form of ……………. values.
a) Binary
b) Octal
c) Decimal
d) Hexadecimal
Answer:
d) Hexadecimal

Question 56.
Every …………. should be declared before they are actually used in a program.
a) Variable
b) Operand
c) Literals
d) None of these
Answer:
a) Variable

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 57.
If we declare a variable without any initial value, the memory space allocated to that variable will be occupied with some unknown value is called as ………….. values.
a) Junk
b) Garbage
c) Either A or B
d) None of these
Answer:
c) Either A or B

Question 58.
A variable can be initialized during the execution of a program is known as ……………..
a) Dynamic initialization
b) Static initialization
c) Random initialization
d) None of these
Answer:
a) Dynamic initialization

Question 59.
………….. is the keyword used to declare a constant.
a) constant
b) const
c) cons
d) None of these
Answer:
b) const

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 60.
…………… keyword modifies / restricts the accessibility of a variable.
a) constant
b) const
c) cons
d) None of these
Answer:
b) const

Question 61.
……………….. is known as Access modifier of a variable.
a) constant
b) const
c) cons
d) None of these
Answer:
b) const

Question 62.
Declaration of a reference consists of ……………..
a) Base type
b) An 8i (ampersand) symbol
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 63.
……………. are used to format the output of any
C++ program,
a) Qualifiers
b) Modifiers ‘
c) Manipulators
d) None of these
Answer:
c) Manipulators

Question 64.
ManIpulators are functions specifically designed to use with the ______ operators.
a) Insertion («)
b) Extraction(»)
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 65.
Commonly used manipulator is …………..
a) endl and setw
b) setfill
c) setprecision and setf
d) All the above
Answer:
d) All the above

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 66.
endl manipulator is a member of  ………………….. header file.
a) iomanip
b) iostream
c) manip
d) conio
Answer:
b) iostream

Question 67.
setw, setfihl, setprecision and setf manipulators are members of______ header file.
a) iomanip
b) iostream
c) manip
d) conio
Answer:
a) iomanip

Question 68.
______ is used asa line feeder in C++.
a) setw
b) setfill
c) endi
d) setf
Answer:
c) endi

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 69.
______ can be used as an alternate to ‘sn’.
a) setw
b) setfill
c) endi
d) setf
Answer:
c) endi

Question 70.
______ inserts a new line and flushes the buffer.
a) setw
b) setfill
c) endi
d) setf
Answer:
c) endi

Question 71.
______ manipulator sets the width of the field assigned for the output.
a) setw
b) setñhl
c) endi
d) setf
i.) IIUI
U) SeIT
Answer:
a) setw

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 72.
_______ manipulator is usually used after setw.
a) endl
b) setfill
c) endl
d) setf
Answer:
b) setfill

Question 73.
______ is used to display numbers with fractions In specific number of digits.
a) ‘endI
b) setfill i1
c) endl
d) setprecision
Answer:
d) setprecision

Question 74.
setf() manipulator may be used in form…………..
a) Fixed
b) Scientific
c) Both A and B
d) None of these
Answer:
c) Both A and B

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 75.
An expression ¡s a combination of ……………………… arranged as per the rules of C++.
a) Operators
b) Constants
c) Variables
d) All the above
Answer:
d) All the above

Question 76.
InC++,there are ………………………….. types of expressions used.
a) four
b) five
c) seven
d) two
Answer:
c) seven

Question 77.
The process of converting one fundamental type into another is called as …………………………
a) Type Conversion
b) Compiling
c) Inverting
d) None of these
Answer:
a) Type Conversion

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 78.
c++ provides …………………… types of conversions
a) three
b) two
c) four
d) five
Answer:
b) two

Question 79.
C++ provides _____types of conversion.
a) Implicit
b) Explicit
c) Both A and B
d) None of these
Answer:
c) Both A and B

Question 80.
A(n) ………………………. type conversion is a conversion performed by the compiler automatically.
a) Implicit
b) Explicit
c) BothAandB
d) None of these
Answer:
a) Implicit

Question 81.
______conversion is also called as Automatic conversion.
a) Implicit ‘
c) BothAandB
b) Explicit
d) None of these
Answer:
a) Implicit ‘

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 82.
Data of smaller type  converted to the wider type, which is called is as ………………
a) Type Promotion
c) Type extended
b) Type upgrade
d) None of these
Answer:
a) Type Promotion

Question 83.
c++ allows explicit conversion of variables or expressions from one data type to another specific data type by the programmer Is called as ………….
a) Type Promotion
b) Type upgrade
c) Type casting
d) None of these
Answer:
c) Type casting

Very Short Answers 2 Marks

Question 1.
What are the classification of data types?
Answer:
In C++, the data types are classified as three main categories.

  1. Fundamental data types
  2. User-defined data types and
  3. Derived data types.

Question 2.
Define: Variable.
Answer:
The variables are the named memory locations to hold values of specific data types.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Give the syntax for declaring a variable with an example.
Answer:
Syntax for declaring a variable:
Example:
int num1;
int num1, num2, sum;

Question 4.
What a the fundamental/atomic data types in C++?
Answer:
Fundamental (atomic) data types are predefined data types available with C++. There are five fundamental data types in C++: char, int, float, double and void.

Question 5.
Write about int data type.
Answer:
Integers are whole numbers without any fraction. Integers can be positive or negative. Integer data type accepts and returns only integer numbers.
If a variable is declared as an int, C++ compiler allows storing only integer values into it.
If we try to store a fractional value in an int type variable it will accept only the integer portion of the fractional value.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 6.
What are the advantages of using float data type?
Answer:
There are two advantages of using float data types.

  1. They can represent values between the integers.
  2. They can represent a much greater range of values.

Question 7.
What is the disadvantage of using float data type?
Answer:
The floating point operations takes more time to execute compared to the integer type ie., floating point operations are slower than integer operations. This is a disadvantage of floating point operation.

Question 8.
What do you mean by precision?
Answer:
Precision means significant numbers after decimal point of floating point number.

Question 9.
Tabulate the memory allocation for fundamental data types?
Answer:
Memory allocation for fundamental data types

Data type

Space in memory

in terms of bytes in terms of bits
char 1 byte 8 bits
int 2 bytes 16 bits
float 4 bytes 32 bits
double 8 bytes’ 64 bits

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 10.
Tabulate the range of value for fundamental data types?
Answer:

Data type

Range of value

char -127 to 128
int -32,768 to 32,767
float 3.4×10--38 to 3.4×1038 -1
double 1.7×10--308 to 1.7xl0308-1

Question 11.
What is modifier?
Answer:
Modifiers can be used to modify the memory allocation of any fundamental data type. They are also called as Qualifiers.

Question 12.
What are the modifiers in C++?
Answer:
There are four modifiers used in C++.
They are;

  1. signed
  2. unsigned
  3. long
  4. short

Question 13.
What are the two values associated with a variable?
Answer:
There are two values associated with a symbolic variable; they are R-value and L-va!ue.

  • R-value is data stored in a memory location.
  • L-value is the memory address in which the R-value is stored.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 14.
How memory addresses are represented?
Answer:
The memory addresses are in the form of Hexadecimal values.
Example: .
0x134e represents a memory address.

Question 15.
What are garbage or junk values?
Answer:
If we declare a variable without any initial value, the memory space allocated to that variable will be occupied with some unknown value. These unknown values are called as “Junk” or “Garbage” values.

Question 16.
What do you mean by dynamic ¡nitialization
Answer:
A variable can be initialized during the execution of a program. It is known as “Dynamic
initiaIization’
For example: .
int sum = num1+num2;
This initializes sum using the known values of num1 and num2 during the execution.

Question 17.
What is the difference between reference and pointer variable?
Answer:
A reference is an alias for another variable whereas a pointer holds the memory address of a variable.

Question 18.
What is the purpose of manipulators in C++?
Answer:
Manipulators are used to format the output of any C++ program. Manipulators are functions specifically designed to use with the insertion (<<) and extraction>>) operators.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 19.
What are the manipulators used in C++?
Answer:
Commonly used manipulators are:
endl, setw, setfill, setprecision and setf.

Question 20.
Write about the endl manipulator.
Answer:
endl (End the Line)
endl is used as a line feeder in C++. It can be used as an alternate to ‘\n’. In other words, endl inserts a new line and then makes the cursor to point to the beginning of the next line.
Example:
cout << “The value of num = ” << num <<endl;

Question 21.
What is the difference between endl and \n.
Answer:
There is a difference between endl and ‘\n’, even though they are performing similar tasks.
endl – Inserts a new line and flushes the buffer (Flush means – clean)
‘\n’ – Inserts only a new line.

Question 22.
Write about setw( ) manipulator.
Answer:
setw ( ) :
setw manipulator sets the width of the field assigned for the output. The field width determines the minimum number of characters to be written in output.
Syntax: ‘
setw(number of characters)
Example:
cout<< setw(25) << “Basic Pay :”<< setw(10)<< basic<< endl;

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 23.
What is the use of setfill( ) manipulator? setfill ():
Answer:
This manipulator is usually used after setw. If the presented value does not entirely fill the given width, then the specified character in the setfill argument is used for filling the empty fields.
Syntax:
setfill (character);
Example:
cout<<“\n H.R.A :”<<setw(10)< For example, if we assign 1200 to hra, setw accommodates 1200 in a field of width 10 from right to left and setfill fills p in the remaining 6 spaces that are in the beginning. The output will be, 0000001200.

Question 24.
What is the purpose of setprecision() manipulator?
Answer:
setprecision ( ):
This is used to display numbers with fractions in specific number of digits.
Syntax:
setprecision (number of digits);
Example:
float hra = 1200.123;
cout << setprecision (5) << hra;
In the above code, the given value 1200.123 will be displayed in 5 digits including fractions. So, the output will be 1200.1
setprecision ( ) prints the values from left to right. For the above code, first, it will take 4 digits and then prints one digit from fractional portion.

Question 25.
WhIch of the following statements are valid? Why? Also write their result
Inta; .
i) a – (014,3);
ii) a = (5,017)
iii) a = (3,018)
Answer:
i) a = (014,3); – Valid. A will hold 3. (The second value)
ii) a = (5,017) – Valid. 014 ¡s an octal constant. It will be converted into decimal and then stored in a. So, a will hold 15 as its value.
iii) a = (3,018) – Invalid. Because 8 is not an octal digit. (A number starts with 0 is considered as an octal)

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 26.
Which of the following statements are valid? Why? Also write their result.
inta;
i) a = (3,0xA);
ii) a = (5,0xCAFE)
iii) a = (OXCAFE,0XF)
iv) a = (0XCAFE,0XG)
Answer:
i) a = (3,0xA):
Valid. OxA is a hexadecimal constant. It will be converted into decimal and then stored in a. So, a will hold 10 as its value.
ii) a = (5,0xCAFE):
Valid. OxCAFE is a hexadecimal constant. It will be converted into decimal and then stored in a. So, a will hold 51966 as its value.
iii) a = (OXCAFE,0XF):
Valid. 0XF is a hexadecimal constant. It will be converted into decimal and then stored in a. So, a will hold 15 as its value.
iv) a= (OXCAFE,0XGAB):
Invalid. Because G is not a hexadecimal digit in OXGAB.\

Short Answer 3 Marks

Question 1.
LIstthedattypesinC++.
Answer:
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 22

Question 2.
Write about character data type.
Answer:
Character data type accepts and returns all valid ASCII characters. Character data type is often said to be an integer type, since ail the characters are represented in memory by their associated ASCII Codes.
If a variable is declared as char, C++ allows storing either a character or an integer value.
Example:
char c=65;
char ch = ‘A’; Both statements will assign ‘A’ to c and ch.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Write note on double data type.
Answer:
double data type:
This data type is for double precision floating point numbers. The double is also used for handling floating point numbers. But, this type occupies double the space than float type. This means, more fractions can be accommodated in double than in float type.
The double is larger and slower than type float. The double is used in a similar way as that of float data type.

Question 4.
Compare memory allocation by Turbo C++ and Dev C++.
Answer:

Data type Memory size in bytes
Turbo C++ Dev C++
short 2 2
unsigned short 2 2
signed short 2 2
int 2 4
unsigned int 2 4
signed int 2 4
long 4 4
unsigned long 4 4
signed long 4 4
char 1 1
unsigned char 1 1
signed char 1 1
float 4 4
double 8 8
long double 10 12

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 5.
What is the purpose of number suffix in C++?
Answer:
There are different suffixes for integer and floating point numbers. Suffix can be used to assign the same value as a different type.
For example, if we want to store 45 in an int, long, unsigned int and unsigned long int, you can use suffix letter L or U (either case) with 45 i.e. 45L or 45U.
This type of declaration instructs the compiler to store the given values as long and unsigned.
‘F’ can be used for floating point values, example: 3.14F

Question 6.
How setprecision( ) is used to set the number of decimal places?
Answer:
setprecision can also be used to set the number of decimal places to be displayed. In order to do this task, we will have to set an ios flag within setf( ) manipulator.
This may be used in two forms:
(i) fixed and
(ii) scientific.
These two forms are used when the keywords fixed or scientific are appropriately used before the setprecision manipulator.
Example:
#include
#indude
using namespace std;
int main()
{
cout.setf(ios::fixed);
cout << setprecision(2)<<0.1;
}
In the above program, ios flag is set to fixed type; it prints the floating point number in fixed notation. So, the output will be, 0.10
cout.setf(ios: scientific); cout << setprecision(2) << 0.1;
In the above statements, ios flag is set to scientific type; it will print the floating point number in scientific notation. So, the output wiil
be, 1.00e-001

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Explain In Detail 5 Marks

Question 1.
What is an expression? Explain its types with suitable example.
Answer:
An expression is a combination of operators, constants and variables arranged as per the rules of C++.
An expression may consist of one or more operands, and zero or more operators to produce a value. In C++, there are seven types of expressions as given below.

Expression

Description

Example

1.Constant Expression Constant expression consist only constant values int num=100;
2. Integer Expression The combination of integer and character values and/or variables with simple arithmetic operators to produce integer results. sum = num1 +

num2;

avg=sum/5;

3. Float Expression The combination of floating point values and/or variables with simple                 arithmetic operators to produce floating point results. Area=3.14*r*r;
4. Relational Expression The combination of values and/or variables with relational operators to produce bool(true means 1 or false means 0) values as results. x>y;

a+b==c+d;

5. Logical Expression The combination of values and/or variables with Logical operators to produce bool values as results. (a>b)&& (c= = 10);
6. Bitwise Expression The combination of values and/or variables with Bitwise operators. x>>3;

a<<2;

7. Pointer Expression A Pointer is a variable that holds a memory address. Pointer                declaration statements. int *ptr;

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 2.
Explain type conversion in detail.
Answer:
The process of converting one fundamental type into another is called as “Type Conversion”. C++ provides two types of conversions.

  1. Implicit type conversion
  2. Explicit type conversion

Implicit type conversion:
An Implicit type conversion is a conversion performed by the compiler automatically. So, implicit conversion is also called as “Automatic
conversion “.
This type of conversion is applied usually whenever different data types are intermixed in an expression. If the type of the operands differs, the compiler converts one of them to match with the other, using the rule that the “smaller” type is
converted to the “wider” type, which is called as “Type Promotion”
Example:
#include<iostream>
using namespace std;
int main()
{
int a=6;
float b =3.14;
cout << a+b
}
In the above program, operand ‘a’ ¡s an mt type and ‘b’ is a float type. During the execution of the program, ‘mt’ is converted into a ‘float because a float is wider than mt.
Hence, the output of the above program will be: 9.14
Explicit type conversion:
C++ allows explicit conversion of variables
or expressions from one data type to another
specific data type by the programmer. It is called
as “type casting”.
Syntax:
(type-name) expression;
Where type-name is a valid C++ data type to which the conversion is to be performed.
Example:
#include<iostream>
using namespace std;
int main ()
{
float varf=78.685;
cout << (int) varf;
}
In the above program, variable varf is declared as a float with an initial value 78.685. The value of varf is explicitly converted to an int type in cout statement. Thus, the final output will be 78.
During explicit conversion, if we assign a value to a type with a greater range, it does not cause any problem. But, assigning a value of a larger type to a smaller type may result in loosing or loss of precision values.
Example:
#include <iostream>
using namespace std;
int main()
{
double varf= 178.25255685;
cout << (float) varf < < endl;
cout << (int) varf << endl;
}
Output
178.253
178

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Evaluate Yourself

Question 1.
What do you mean by fundamental data types?
Answer:
C++ provides a predefined set of data types for handling the data items. Such data types are known as fundamental or built-in data types.

Question 2.
The data type char is used to represent characters. Then why is it often termed as an integer type?
Answer:
Character data type is often said to be an integer type, since all the characters are represented in memory by their associated ASCII Codes.

Question 3.
What is the advantage of floating point numbers over integers?
Answer:
Advantages of using float data types.

  • They can represent values between the integers.
  • They can represent a much greater range of values.

Question 4.
The data type double is another floating point type. Then why is it treated as a distinct data type?
Answer:
The double is also used for handling floating point numbers. But, this type occupies double the space than float type. This means, more fractions can be accommodated in double than in float type.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 5.
What is the use of void data type?
Answer:
The literal meaning for void is ’empty space’. In C++, the void data type specifies an empty set of values. It is used as a return type for functions that do not return any value.

Evaluate Yourself

Question 1.
What is modifiers? What is the use of modifiers?
Answer:
Modifiers are used to modify the storing capacity of a fundamental data type except void type.
For example, int data type can store only two bytes of data. In reality, some integer data may have more length and may need more space in memory. In this situation, we should modify the memory space to accommodate large integer values. .
Modifiers can be used to modify the memory allocation of any fundamental data type. They are also called as Qualifiers.

Question 2.
What is wrong with the following C++ statement?
Answer:
long float x;
The modifier long must be associated with only double.

Question 3.
What Is variable? Why a variable called symbolic variable?
Answer:
Variables are user-defined names assigned to specific memory locations in which the values are stored. Variables are also identifiers; and hence,
the rules for naming the identifiers should be followed while naming a variable.
These are called as symbolic variables because these are named locations.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 4.
What do you mean by dynamic initialization of a variable? Give an example.
Answer:
A variable can be initialized during the execution of a program. It is known as Dynamic
initialization.
For example:
int sum = num1+num2;
This initializes sum using the known values of num1 and num2 during the execution.

Question 5.
What is wrong with the following statement?
Answer:
const int x ;
In the above statement x must be initialized. It is missing. It may rewritten as
const mt x =10;

Evaluate Yourself

Question 1.
What is meant by type conversion?
Answer:
The process of converting one fundamental type into another is called as “Type Conversion”. C++ provides two types of conversions.

  1. Implicit type conversion
  2. Explicit type conversion

Question 2.
How implicit conversion different from explicit conversion?
Answer:
An Implicit type conversion is a conversion performed by the compiler automatically. Implicit conversion is also called as “Automatic conversion”.
An explicit conversion of variables or expressions from one data type to another specific data type is by the programmer. It is called as “type casting”.

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
What is difference between endl and \n?
Answer:
There is a difference between endl and ‘\n’ even though they are performing similar tasks.
endl – Inserts a new line and flushes the buffer (Flush means – dean)
‘\n’ – Inserts only a new line.

Question 4.
What is the use of references?
Answer:
A reference provides an alias for a previously defined variable. Declaration of a reference consists of base type and an & (ampersand) symbol; reference variable name is assigned the value of a previously declared variable.
Syntax:
<&reference_variable>=

Question 5.
What is the use of setprecision ( )?
Answer:
setprecision ( ):
This is used to display numbers with fractions in specific number of digits.
Syntax:
setprecision (number of digits);
Example:
float hra = 1200.123;
cout << setprecision (5) << hra;
The given value 1200.123 will be displayed in 5 digits including fractions. The output will be 1200.1

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Hands On Practice

Question 1.
Write C++ programs to interchange the values of two variables.
a) Using with third variable C++PROGRAM:
#include
using namespace std;
int main()
{
intx,y,t;
cout<<“\nEnter two numbers”; cin>>x>>y;
cout<<“\nValues before interchage
x=”<<x<<“\ty=”<<y;
t=x;
x=y;
y=t;
cout<<“\nValues after interchage x=”<<x<<“\ty=”<<y;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 23

b) Without using third variable C++ PI OGRAM:
#include
using namespace std;
int main ()
{
int x,y;
cout<<“\nEnter two numbers”; cin>>x>>y;
cout<<“\nValues before interchage
x=”<<x<<“\ty=”<<y;
//interchage process without using third
variable
x=x+y;
y=x-y;
x=x-y;
cout<<“\nValues after interchage x=”<<x<<“\ty=”<<y;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 24

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 2.
Write C++ programs to do the following:
a) To find the perimeter and area of a quadrant.
C++ PROGRAM:
#include
using namespace std;
int mainQ()
{
float ppm,area;
cout<<“\nEnter radius cin>>r;
area = 3.14 * r * r / 4;
pm = 3.14 * r / 2;
cout<<“\nQuadrant Area = “<<area;
cout<<“\n\nQuadrant Perimeter = “<<pm;
return 0;
}
OutPut
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 25

b) To find the area of triangle.
C++ PROGRAM 1:
(Area of triangle when b and h values are known)
#include
using namespace std;
int main()
{
float b,h,area;
cout<<“\nEnter b and h value of triangle cin>>b>>h;
// Area of triangle when b and h values are known
area = b * h / 2;
cout<<“‘\nBase value = “<<b<<“Height = “<<h<<“Triangle Area = “<<area;
return 0;
}
OutPut
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 26
C++ PROGRAM 2:
(Area of triangle when three sides are known)
#inciude
#include using namespace std;
int main()
{
float a,b,c,area,s;
cout<<“\nEnter three sides of triangle cin>>a>>b>>c;
//Area of triangle when three sides are known
s = (a+b+c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
cout<<“\n Sidel value = “<<a<<“Side2
value = “<<b<<” Side3 value =”<<c;
cout<<“\nTriangie Area = “<<area;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 27
c. To convert the temperature from Celsius to Fahrenheit.
C++ PROGRAM:
//Convertion of the temperature from Celsius to Fahrenheit
#include< iostream>
using namespace std;
int main()
{
float c,f;
cout<<”\nEnter Celsius value “; cin>>c;
f=9*c/5+32;
cout«”\nTemperature in Celsius = “<<C;
cout < <“\nTemperature in Fahrenheit =
“<<f;
return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 28

Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++

Question 3.
Write a C++ to find the total and percentage of marks you secured from 10th Standard Public Exam. Display all the marks one-by- one along with total and percentage. Apply formatting functions.
C++ PROGRAM:
#include
#include
using namespace std;
int rnain()
{
int tarn,enm,mam,som,scm,total,avg; char name[30];
cout<<“\nEnter name of the student cin>>name;
cout<<“\nEnterTamil mark”; cin>>tam;
cout<<“\nEnter English mark”; cin>>enm;
cout<<“\nEnter Maths mark “; cin>>mam;
cout<<“\nEnter Science mark “; cin>>scm;
cout<<“\nEnter Social Science mark”; cin>>som; .
total = tarn + enm + mam + scm + som; avg = total / 5;
cout<<“\n\t\tlOth Standard Public Exam Mark”<<end!<<endl;
cout<<setw(30)<<“Name of the student «name<<endk<endl;
cout<<setw(30)<<setfill(“)<<“Tamil mark
< <setw(3)< <setfill(‘0’)< <tam< cout<<setw(30)<<setfillC ‘)<<“English
mark “<setw(3)<<setfill(‘0’)<<enm< cout<<setw(30)<<setfillC ‘)<<“Maths mark
< <setw(3)< <setfillCO’)< <mam< <endl< <endl;
cout<<setw(30)<<setfillC ‘)<<“Science
mark :”<<setw(3)<<setfill(‘0’)<<scm< cout< < setw(3G) < < setfi 11C ‘) < < “Soda I
Science mark :”<<setw(3)<<setfillC0’)< cout<<setw(30)<<setfillC ‘)«’Total Marks <<setw(3)<<setfillC0’)<<totak<endk<endl;
cout<<setw(30)«setfillC ‘)«”Average mark:”
<<setw(3)<<setfill(‘0’)< return 0;
}
Output
Samacheer Kalvi 11th Computer Science Guide Chapter 9 Introduction to C++ 29

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Tamilnadu State Board New Syllabus Samacheer Kalvi 12th Computer Applications Guide Pdf Chapter 12 DNS (Domain Name System) Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 12th Computer Applications Solutions Chapter 12 DNS (Domain Name System)

12th Computer Applications Guide DNS (Domain Name System) Text Book Questions and Answers

Part I

Choose The Correct Answers
Question 1.
Which of the following is used to maintain all the directory of domain names?
a) Domain name system
b) Domain name space
c) Name space
d) IP address
Answer:
a) Domain name system

Question 2.
Which of the following notation is used to denote IPv4 addresses?
a) Binary
b) Dotted-decimal
c) Hexadecimal
d) a and b
Answer:
d) a and b

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
How many bits are used in the IPv addresses?
a) 32
b) 64
c) 128
d) 16
Answer:
c) 128

Question 4.
Expansion of URL is
a) Uniform Resource Location
b) Universal Resource Location
c) Uniform Resource Locator
d) Universal Resource Locator
Answer:
c) Uniform Resource Locator

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
How many types are available in Relative URL?
a) 2
b) 3
c) 4
d) 5
Answer:
a) 2

Question 6.
Maximum characters used in the label of a node?
a) 255
b) 128
c) 63
d) 32
Answer:
c) 63

Question 7.
In domain name, sequence of labels are separated by
a) ;
b) .(dot)
c) :
d) NULL
Answer:
b) .(dot)

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 8.
Pick the odd one out from the following.
a) node
b) label
c) domain
d) server
Answer:
d) server

Question 9.
Which of the following initiates the mapping of the domain name to IP address?
a) Zone
b) Domain
c) Resolver
d) Name servers
Answer:
b) Domain

Question 10.
Which is the contiguous area up to which the server has access?
a) Zone
b) Domain
c) Resolver
d) Name servers
Answer:
a) Zone

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 11.
ISP stands for
a) International Service provider
b) Internet Service Provider
c) Internet service Protocol
d) Index service provider
Answer:
b) Internet Service Provider

Question 12.
TLD stands for
a) Top Level Data
b) Top Logical Domain
c) Term Level Data
d) Top Level Domain
Answer:
d) Top Level Domain

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 13.
Which of the following statements are true?
i) Domains name is a part of URL.
ii) URL made up of four parts
iii) The relative URL is a part of the Absolute URL
iv) URL doesn’t contain any protocol
a) i & ii
b) ii
c) i, ii & iii
d) i, ii & iv
Answer:
b) ii

Question 14.
Assertion (A): The number of addresses used in the IPv6 addressing method is 128.
Reason (R): IPv6 address is a 128-bit unique address.
a) A is true and R is false.
b) A is false and R is true.
c) Both A and R are correct and R is the correct explanation of A.
d) Both A and R are correct and R is not the correct explanation of A.
Answer:
b) A is false and R is true.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 15.
Match the following
a. domain – 1. The progress that initiates translation
b. zone – 2. contains a database of domain names
c. name server 3. single node
d. resolver 4. contiguous nodes
a. 1432
b. 3421
c. 3214
d. 3412
Answer:
a. 1432

Part II

Short Answers

Question 1.
List any four domain names.
Answer:
Domain Name:

  1. com
  2. edu
  3. gov
  4. mil

Meaning:

  1. Commercial Organisation
  2. Educational Institution
  3. Government (US)
  4. Military groups

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 2.
What is an IP address?
Answer:

  • Internet Protocol (IP) address is simply the logical address in the network layer.
  • Like how the door number/flat number is used to 10. differentiate individual house from others in the same apartment
  • IP address is also used to find the host system in the whole network.

Question 3.
What are the types of IP address?
Answer:

  1. IPv4 Address
  2. IPv6 Address

Question 4.
What is an URL?
Answer:

  • URL (Uniform Resource Locator) is the address of a document on the Internet.
  • URL is made up four parts-protocols, hostname, folder name and file name.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
List out four URLs you know.
Answer:
URL:

  1. http: //www. example.com/index, html
  2. http://www.computer.com
  3. http://www.ibm.com
  4. https://www.hellotravel.com

Question 6.
What are the types of URLs?
Answer:
Depending on the location of the document the URL is divided into 2 types

    1. Absolute URL
    2. Relative URL

Question 7.
What is a domain?
Answer:

  • A domain is a single node of the Domain Namespace.
  • In the domain name space (DNS) tree structure domain is a sub structure tree. The domain can be further divided into sub domains.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 8.
What is a zone?
Answer:

  • Zone is the contiguous part up to which the server has access.
  • The domain assigned for the server does not divide into further subdomains the zone is the same as the domain.

Question 9.
What is a resolver?
Answer:

  • Resolver is a program which is responsible for initiating the translation of a domain name into an IP address.
  • A host system need to map domain name to IP address or vice versa according to the call and that work is done by resolver.

Question 10.
What are the categories available in domain name space?
Answer:
There are 3 important components in the Domain Name System. They are Namespace, Name server and Zone.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 11.
Write any four generic Top-Level Domain.
Answer:

Domain Name Meaning
com Commercial Organisation
edu Education Institutions
gov Government (US)
mil Military groups

Part III

Explain In Brief Answer

Question 1.
Write a note on DNS.
Answer:

  • Domain name space was designed to achieve a hierarchical namespace.
  • In this, the names are represented as a tree-like structure with a root element on the top and this tree can have a maximum of 128 levels starting from the root element taking the level 0 to level 127.

Question 2.
Differentiate IPv4 and IPv6.
Answer:

IPv4

IPv6

It has a 32-bit address length It has a 128-bit address length
It Supports Manual and DHCP address configuration It supports Auto and renumbering address configuration
In IPv4 end to end, connection integrity is Unachievable In IPv6, end to end connection integrity is Achievable
It can generate 4.29×109 address space Address space of IPv6 is quite large it can produce 3.4×1038 address space

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
Differentiate Domain name and URL
Answer:

URL

DOMAIN NAME

URL is a full web address used to locate a webpage. A domain name is the translated and simpler form of a computer’s IP address (Logical address).
Complete web address containing domain name also. Part of the URL defines an organization or entity.
The method, hostname (domain name), port, and path. Based on subdomains (top-level, intermediate level, low level)

Question 4.
What are the differences between Absolute URL and Relative URL?
Answer:

Absolute URL

Relative URL

Absolute URL is the complete address of a document on the Inter­net. Relative URL is the par­tial address of a docu­ment on the Internet.
Absolute URL contains all the information that are required to find the files on the Internet. Relative URL contains only file name or file name with folder name.
If any of the four parts is missing then the browser would not able to link to the specific file We can use this type of URL when the file is on the same server related to the original document.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
Write a note on the domain name.
Answer:

  1. Domain name is the sequence of labels. In domain name the sequence of labels are separated ‘ by dot (.).
  2. The domain name is always read from the lower level to higher level i.e., from the leaf node to root node.
  3. Since the root node always represents NULL string, all the domain name ending with dot.

Question 6.
Differentiate web address and URL
Answer:

WEB ADDRESS

URL

A Web Address more commonly defines a unique name that helps people remember a URL. A URL is the address of a particular website, an audio stream, or document available on the Web.
It is like a memorable street address, can help people find you online. It is the Internet address of a particu­lar site or document available via the World Wide Web.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Part IV

Explain In Detail

Question 1.
Explain briefly the components of DNS.
Answer:

DNS Components:
There are three important components in the Domain Name System. They are:

  1. Namespace
  2. Name server
  3. Zone

1. Name Space:

  • The domain names must be very unique and appropriate. The names should be selected from a namespace.
  • The name space can be organized in two ways
  • Flat name space
  • Hierarchical name space
  • Flat name space is where the name is assigned to the IP address. They do not have any specific structure.
  • Hierarchical name space is where the name is made up of several parts. The first part may represent the nature of organization, the second part may represent the name of organization, and third part may represent the department of the organization.
  • Domain name space was designed to achieve hierarchical name space.

2. Name Servers:

  • The information which needs to be stored in Domain name space is quite large. Single system would be inefficient to store such a huge amount as responding to requests from all over the world. It also becomes unreliable because in case of any failure the data becomes inaccessible.
  • Name Server is a main part in the Domain Name System (DNS). It trAnswer:late the domain names to IP addresses.
  • Name server contains the DNS database which consists of domain names and their corresponding IP addresses.
  • There is a need to store large number of domain names for the world wide usage, so plenty of servers are used in the hierarchical manner.
  • Name servers do the important task of searching the domain names. While you searching a website, Local Name server (provided by ISP) asks the different name servers until one of them find out your Answer. At last, it returns IP address for that domain name.

3. Zone:

  • The entire namespace is divided into many different zones. It is the area up to which the server has access.
  • Zone is defined as a group of contiguous domains and sub-domains. If the zone has a single domain, then the zone and domain are the same.
  • Every zone has a server which contains a database called a zone file. Using the zone file, the DNS server replies the queries about hosts in its zone. There are two copies of zone files available, Master file and slave file.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 2.
Classify and Explain the IP address.
Answer:

  • Internet Protocol (IP) address is simply the logical address in the network layer.
  • Like how the door number/flat number is used to differentiate an individual house from others in the same apartment.
  • An IP address is also used to find the host system in the whole network.
  • Due to increase in the number of system in a network, there is a need of more addresses which lead to two addressing methods i.e., IPv4 and IPv6.

IPv4 Address

  • It IPv4 address is a 32-bit unique address given to a computer system.
  • No two systems can have same IP address.
  • If the network has p connections then ‘ip’ addresses should be there.
  • An address space is the total number of address¬es that can be made by that protocol.
  • It is determined by the number of bits that the protocol used.
  • If the protocol uses ‘n’ bits then the address space of that protocol would be ‘2n’ addresses can be formed. So, the number of addresses that can be formed in IPv4 is 232,
  • There are two ways to represent the IP address
    • Binary notation
    • Dotted-decimal notation
  • In binary notation the address is expressed as 32-bit binary values.
    • For E.g. 00111001 10001001 111000 00000111
  • In dotted-decimal notation the address is written in decimal format separated by dots(.). For e.g. 128.143.137.144

IPv6 Address

  • IPv6 address is a 128-bit unique address given to a computer system.
  • The number of addresses that can be formed in IPv6 is 2128. In IPv6 address, the 128 bits are divided into eight 16-bits blocks.
  • Each block is then changed into 4-dig¬it Hexadecimal numbers separated by colon symbols.
  • E.g. 2001:0000:32313:DFE1:0063:0000:0000:F EFB.a

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
Explain about the name server?
Answer:
Name Servers:
1. The information which needs to be stored in the Domain namespace is quite large. A single system would be inefficient and insufficient to store such a huge amount as responding to requests from all over the world. It also becomes unreliable because in case of any failure the data becomes inaccessible.

2. The solution to this problem is to distribute the information among many computers. The best way to do that is to divide the entire space into many domains and subdomains

3. DNS also allows domains to be further divided into subdomains. By this, the solution to the problem is obtained and the hierarchy of servers is also maintained.

4. Name servers store the data and provide it to clients when queried by them. Name Servers are programs that run on a physical system and store all the zone data.

5. Name Server is a main part in the Domain Name System (DNS). It translates the domain names to IP addresses.

6. Name server contains the DNS database which consists of domain names and their corresponding IP addresses.

7. There is a need to store large number of domain names for worldwide usage, so plenty of servers are used in a hierarchical manner.

8. Name servers do the important task of searching the domain names. While you searching a website, the Local Name server (provided by ISP) ask the different name servers until one of them find out your Answer. At last it returns IP address for that domain name.

Types of Name Servers
There are three types of Name Servers which control the entire Domain Name System:
(i) Root Name Server – top-level server which contains entire DNS tree, maintained by ICANN.
There are 13 servers.

(ii) Primary/Master Name Server – contains a zone resource records. These records are updatable by domain name holders such as organizations.

(iii) Secondary/Slave Name Server – contains a copy of primary server files. This server has no authority to update, but reduce the workload of master server by sharing the queries.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 4.
What is domain name space? Explain.
Answer:

  • Domain name space was designed to achieve hierarchical name space.
  • In this, the names are represented as a tree like structure with root element on the top and this tree can have a maximum of 128 levels starting from root element taking the level 0 to level 127.
  • The domain namespace where the root element is present at the top most level i.e., level 0.
  • The root element always represents the NULL string (empty string).
  • The next level to the root element is node (children of root element). Each node in the tree has a label and a domain name.

Label:

  • It is a string which can have maximum of 63 characters.
  • Each node in that level should have different labels thereby assuring the individuality of the domain name.
  • In other words, Labels are the names given to domains.
  • Domain is a sub tree in domain name space tree structure. The domain can be further divided into sub domains.

Domain name

  • It is the sequence of labels. In domain name the sequence of labels are separated by dot (.).
  • The domain name is always read from the lower level to higher level i.e., from the leaf node to root node.
  • Since the root node always represent NULL string, all the domain name ending with dot.

Basic rules of Domain names

  • Domain can consists of Alphabets a through z, and the digits 0 through 9.
  • Hyphens are allowed, but hyphens cannot be used as first character of a domain name.
  • Spaces are not alloweds
  • Special symbols (such as !, $, &,. not permitted.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
Explain how the DNS is working.
Answer:

  1. When the user enters the URL (consists of a protocol, domain name, folder name, filename) in the browser, the system fist checks its DNS cache for the corresponding IP address.
  2. If the IP address is found in the cache then the information is retrieved from the cache.
  3. If not, then the system needs to perform a DNS query i.e., the system needs to query the resolver about the IP address from Internet Service Provider (ISP).
  4. Each resolver has its own cache and if it is found in that then that information is retrieved.
  5. If not, then the query is passed to the next domain server i.e., TLD (Top Level Domain) which reviews the request and directs the query to name servers associated with that specific domain.
  6. Until the query is solved it is passed to next level domains. At last, the mapping and the record are returned to the resolver who checks whether the returned value is a record or an error.
  7. Then the resolver returns the record back to the computer browser which is then viewed by the user.

12th Computer Applications Guide DNS (Domain Name System) Additional Important Questions and Answers

Part A

Choose The Correct Answers:

Question 1.
Expand DNS?
(a) Direct Name Server
(b) Domain Name System
(c) Domain Name Security
(d) Direct Name Service
Answer:
(b) Domain Name System

Question 2.
For the communication to takes place, the information should pass through …………… layers
a) six
b) two
c) end to end
d) Seven
Answer:
d) IP addresses

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
While typing a web address, DNS translates it into a machine-friendly IP address.
(a) True
(b) False
Answer:
(a) True

Question 4.
DNS provides the domain name to IP address mapping through ………….
a) IP address
b) Name Servers
c) domain
d) URL
Answer:
b) Name Servers

Question 5.
Paul V. Mockapetris together with ………………. invented the Internet Domain Name System (DNS).
a) Jon Postel
b) Dennis Ritchie
c) James Gostling
d) Carrelli
Answer:
a) Jon Postel

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 6.
IP stands for …………………
(a) Input process
(b) Input
(c) Internet Protocol
(d) Internet Power
Answer:
(c) Internet Protocol

Question 7.
……………….. is available below the root domain.
a) IANA
b) IPv4
c) IPv6
d) TLD
Answer:
d) TLD

Question 8.
How many IP addressing methods are there?
(a) 1
(b) 2
(c) 3
(d) 4
Answer:
(b) 2

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 9.
…………. is a program running on a dedicated machine which handles the queries of www end-user.
a) Webserver
b) Web Host
c) DNS
d) HTML
Answer:
a) Webserver

Question 10.
If the protocol uses ‘n’ bits then the address space of that protocol would be …………………….
(a) n
(b) n2
(c) 2n
(d) 2n
Answer:
(d) 2n

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Fill in The Blanks.

1. …………… is a logical address used to uniquely identify a computer over the Network.
Answer:
IP address

2. IPv4 address is a …………… unique address given to a computer or a device.
Answer:
32 bit

3. IPv6 address is a ……………. unique address given to a computer or a device.
Answer:
128 bit

4. …………… follows Hexadecimal number notation.
Answer:
IPv6

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

5. ……………. is the address of a document on the Internet.
Answer:
URL (Uniform Resource Locator)

6. ……………… contains only folder name and the file name or just the file name.
Answer:
Relative URL

7. …………….. is a tree-like structure with a root element on the top.
Answer:
Domain namespace.

8. The domain name is always read from the …………….
Answer:
leaf node to root node.

9. In the domain name space (DNS) tree structure …………… is a substructure tree.
Answer:
domain

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

10. …………. are programs that run on a physical system and store all the zone data.
Ans :
Name Servers

11. ……………….. provides to clients when queried by them.
Answer:
Name Servers

12. ……………. non-profit organization which regulates the Internet.
Answer:
ICANN

13. ………….. is an affiliated authority of ICANN.
Answer:
IANA (Internet Assigned Numbers Authority)

14. ……………… is a group of contiguous domains and subdomains in the Domain Name Space.
Answer:
Zone

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Assertion And Reason

Question 1.
Assertion (A): Domain Name System (DNS) maintains all the directory of domain names and helps us to access the websites using the domain names.
Reason(R): t translates the domain name into an IP address.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
c) (A) is true and (R) is false

Question 2.
Assertion (A): IPv4 address is a 64-bit unique address.
Reason(R): There are two ways to represent the IP address: Binary notation, Dotted-decimal notation.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
d) (A) is false and (R) is true

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
Assertion (A): Label is a string
Reason(R): Label can have a maximum of 63 characters
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)

Question 4.
Assertion (A): Domain namespace is a tree-like structure with a root element on the top
Reason(R); it can have a maximum of 127 levels starting from the root element
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
c) (A) is true and (R) is false

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
Assertion (A): The Resolver is a service of ICANN
Reason(R): Resolver, a client/ server application, initiates the process of resolving the domain names.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
d) (A) is false and (R) is true

Question 6.
Assertion (A): URL Stands for Uniform Resource Locator
Reason(R): URL- the address of a specific web page or file on the Internet.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)

Question 7.
Assertion (A): A web server is a program running on a dedicated machine which handles the queries of the www end user.
Reason(R): A web server is a type of Web Host.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
c) (A) is true and (R) is false

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Find The Odd One On The Following

1. (a) File Name
(b) Protocol
(c) HTML
(d) Host Name
Answer:
(c) HTML

2. (a) Label
(b) Namespace
(c) Name server
(d) Zone
Answer:
(a) Label

3. (a) Flat Namespace
(b) Domain Namespace
(c) Host Namespace
(d) Hierarchical Namespace
Answer:
(c) Host Namespace

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

4. (a) Tree Like Structure
(b) 128 Levels
(c) NULL string
(d) Flat Namespace
Answer:
(d) Flat Namespace

5. (a) .com
(b) -ta
(c) .gov
(d) .nic
Answer:
(b) -ta

6. (a) com
(b) net
(c) bd
(d) info
Answer:
(c) bd

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

7. (a) India
(b) Malaysia
(c) Singapore
(d) Srilanka
Answer:
(b) Malaysia

8. (a) Name server
(b) DNS Database
(c) IP Address
(d) HTTP
Answer:
(d) HTTP

9. (a) Primary Name Server
(b) Secondary Name Server
(c) Node Name Server
(d) Root Name Server
Answer:
(c) Node Name Server

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

10. (a) Host
(b) Webserver
(c) DNS server
(d) Namespace
Answer:
(d) Namespace

11. (a) Name server
(b) Resolver
(c) ICANN
(d) Zone
Answer:
(c) ICANN

12. (a) 32 bit
(b) Binary Notation
(c) Hexadecimal
(d) Dotted decimal
Answer:
(c) Hexadecimal

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

13. (a) WHOIS
(b) ICANN
(c) IAN
(d) FORTRAN
Answer:
(d) FORTRAN

14. (a) 128bit
(b) 16block
(c) Hexadecimal
(d) Binary notation
Answer:
(d) Binary notation

15. (a) in
(b) cn
(c) gov
(d) pk
Answer:
(c) gov

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Very Short Answers

Question 1.
What is a domain?
Answer:
A domain is a single node of the Domain Namespace.

Question 2.
What is Zone?
Answer:
A zone is a subset of the Domain namespace generally stored in a file.

Question 3.
What is Domain Name Space?
Answer:
Domain Namespace is an entire collection of Domains, Subdomains, and Zones.

Question 4.
What is a Name Server?
Answer:
Name server manages the database of domain names and corresponding IP addresses.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 5.
What does the zone contain?
Answer:
A zone can contain more than one subdomain.

Question 6.
What does the server contain?
Answer:
A server can contain more than one zone file (Zones).

Domain Name Meaning

DOMAIN

MEANING

com Commercial Organisation
edu Educational Institutions
gov Government (US)
mil Military groups
org Nonprofit Organization
net Networking organization
info Information service providers

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Part B

Short Answers

Question 1.
Name the four parts of the URL?
Answer:
URL is made up of four parts-protocols, hostname, folder name, and file name. Each part has its own specific functions. Depending on the applications, additional information can be added to the URL but the common and fundamental URL consists of these four parts.

Question 2.
List the three components of DNS?
Answer:

  1. NameSpace
  2. Name server
  3. Zone

Question 3.
What is a Label?
Answer:

  • The label is a string which can have a maximum of 63 characters.
  • Each node in that level should have different labels thereby assuring the individuality of the domain name.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 4.
Name the three domain names used in Tamil language?
Answer:
India,
Singapore,
Srilanka.

Question 5.
What is the Inverse domain?
Answer:
Inverse domain performs the opposite task of the normal DNS query. It converts the IP address to the domain name.

Question 6.
What is Zone File?
Answer:
Every zone has a server which contains a database called a zone file.

Question 7.
What are the two copies of the zone file?
Answer:
There are two copies of zone files available, they are

  1. Masterfile
  2. Slave file.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 7.
Write the demerits of the Flat namespace?
Answer:
The major disadvantage of flat namespaces is that they cannot be used in large systems. Because they need to be accessed and controlled centrally to avoid ambiguity and redundancy.

Part C

Explain In Brief Answer

Question 1.
What are the fundamentals of URL?
Answer:

  • URL is made up of four parts-protocols, hostname, folder name, and file name.
  • Each part has its own specific functions. Depending on the applications, additional information can be added to the URL but the common and fundamental URL consists of these four parts.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System) 1

    • Protocol
    • Domain name/Hostname
    • Folders
    • Filename with extension

Question 2.
What is meant by Label?
Answer:
Label:
It is a string which can have a maximum of 63 characters. Each node in that level should have different labels thereby assuring the individuality of the domain name. In other words, Labels are the names given to domains. The domain is a subtree in the domain name space tree structure. The domain can be further divided into subdomains.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Question 3.
Write a note on Country top-level domain names.
Answer:

  • Country domain uses 2-character country abbreviation according to country.
  • For e.g., google.in – for INDIA, Google’s for US.Some of the Domain Name and their meaning listed below.
    table

Question 4.
Explain the types of Name servers?
Answer:
Types of Name Servers:
There are three types of Name Servers which control the entire Domain Name System:
Root Name Server – top-level server which contains the entire DNS tree, maintained by ICANN. There are 13 servers.

Primary/Master Name Server- contains zone resource records. These records are updatable by domain name holders such as organizations.

Secondary/Slave Name Server – contains a copy of primary server files. This server has no authority to update but reduces the workload of the master server by sharing the queries.

Samacheer Kalvi 12th Computer Applications Guide Chapter 12 DNS (Domain Name System)

Part IV

Explain In Detail

Question 1.
Explain the Basic rules of Domain names?
Answer:
Basic rules of Domain names:

  1. A domain can consist of Alphabets a through z, and the digits 0 through 9.
  2. Hyphens are allowed, but hyphens can not be used as the first character of a domain name.
  3. Spaces are not allowed.
  4. Special symbols (such as ! $, &, _ and so on) are not permitted, length of 2, and the maximum length of 63 characters.
  5. The entire name may be at most 253 characters long.
  6. Domain names are not case-sensitive.(It may be upper, lower, or mixing of both case letters)

Question 2.
Write a note on the Hierarchical namespace?
Answer:

  • To avoid the major disadvantage of the Flat namespace, the hierarchical namespace is used in large.
  • A hierarchical namespace is where the name is made up of several parts.
    • The first part may represent the nature of the organization,
    • The second part may represent the name of the organization, and
    • Third-party may represent the department of the organization and so on.
  • In this way, the power to control the namespace can be decentralized.
  • The centralized authority can be given to nature and then the name of the organization and so on.
  • To achieve a hierarchical namespace, Domain Name Space was designed.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Tamilnadu State Board New Syllabus Samacheer Kalvi 12th Computer Applications Guide Pdf Chapter 13 Network Cabling Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 12th Computer Applications Solutions Chapter 13 Network Cabling

12th Computer Applications Guide Network Cabling Text Book Questions and Answers

Part I

Choose The Correct Answers

Question 1.
ARPANET stands for
a) American Research Project Agency Network
b) Advanced Research Project Area Network
c) Advanced Research Project Agency Network
d) American Research Programs And Network
Answer:
c) Advanced Research Project Agency Network

Question 2.
WWW was invented by
a) Tim Berners Lee
b) Charles Babbage
c) Blaise Pascal
d) John Napier
Answer:
a) Tim Berners Lee

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 3.
Which cable is used in cable TV to connect with setup box?
a) UTP cable
b) Fibre optics
c) Coaxial cable
d) USB cable
Answer:
c) Coaxial cable

Question 4.
Expansion of UTP is
a) Uninterrupted Twisted Pair
b) Uninterrupted Twisted Protocol
c) Unshielded Twisted Pair
d) Universal Twisted Protocol
Answer:
c) Unshielded Twisted Pair

Question 5.
Which medium is used in the optical fibre cables to transmit data?
a) Microwave
b) infra red
c) light
d) sound
Answer:
c) light

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 6.
Which of the following is a small peripheral device with a sim slot to connect the computers to Internet?
a) USB
b) Dongles
c) Memory card
d) Mobiles
Answer:
a) USB

Question 7.
Which connector is used in the Ethernet cables?
a) RJ11
b) RJ21
c) RJ61
d) RJ45
Answer:
d) RJ45

Question 8.
Which of the following connector is called as champ connector?
a) RJ11
b) RJ21
c) RJ61
d) RJ45
Answer:
b) RJ21

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 9.
How many pins are used in RJ45 cables?
a) 8
b) 6
c) 50
d) 25
Answer:
a) 8

Question 10.
Which wiring standard is used for connecting two computers directly?
a) straight Through wiring
b) Cross Over wiring
c) Rollover wiring
d) None
Answer:
b) Cross Over wiring

Question 11.
Pick the odd one out from the following cables
a) roll over
b) cross over
c) null modem
d) straight through
Answer:
c) null modem

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 12.
Match the following
1. Ethernet – Port
2. RJ45 connector – Ethernet
3. RJ45 jack – Plug
4. RJ45 cable – 802.3
a) 1, 2, 4, 3
b) 4, 1, 3, 2
c) 4, 3, 1, 2
d) 4, 2, 1, 3
Answer:
d) 4, 2, 1, 3

Part II

Short Answers

Question 1.
Write a note on twisted pair cable?
Answer:

  • Twisted Pair Cables is a type of cable with two or more insulated wires twisted together.
  • It started with the speed of 10 Mbps (10BASE-T cable is used).
  • It started with the speed of 10 Mbps (10BA.SE-T cable is used).
  • Then the cable is improved and the speed was higher and went to 100 Mbps and the cable was renamed 100BASE-TX.

Question 2.
What are the uses of USB cables?
Answer:

  • The Universal Serial Bus is used to connect the keyboard, mouse, and other peripheral devices.
  • Micro USB is a miniaturized version of the USB used for connecting mobile devices such as smartphones, GPS devices, and digital cameras.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 3.
Write a note on the types of RJ45 connectors?
Answer:

  1. Wiring schemes specify how the wires to be connected with the RJ45 connector.
  2. There are two wiring schemes available to terminate the twisted-pair cable on each end, which are
    • T-568A
    • T-568B.

Question 4.
What is an Ethernet port?
Answer:

  • The Ethernet port is the jack where the Ethernet cable is to be connected.
  • This port will be there In both the computers and the LAN port.

Question 5.
What is the use of the Crimping tool?
Answer:
A crimping tool is a physical tool which is used to connect the patch wire and the Ethernet connector. The tool will puncture the connector and makes the wire set in the connector.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 6.
What are the types of twisted pair cables?
Answer:
There are two types of twisted pair cables, Unshielded Twisted Pair (UTP) and Shielded Twisted pair (STP). The UTP is used nowadays as modem cables for the Internet and they are lower in cost and installation and maintenance is easy compared to the coaxial cables.

Question 7.
What is meant by champ connector?
Answer:
The RJ-21 connector has 50 pins with 25 pins at one end and 25 pins at the other end. It is also called a champ connector or Amphenol connector. The Amphenol is a connector manufacturer. The RJ-21 interface is typically used for data communication trucking applications.

Part III

Explain In Brief Answer

Question 1.
Write a note on crossover cables.
Answer:

  • If you require a cable to connect two computers or Ethernet devices directly together without a hub, then you will need to use a Crossover cable instead.
  • The easiest way to make a crossover cable is to make one end to T568A colour coding and the other end to T568B.
  • Another way to make the cable is to remember the colour coding used in this type. Here Green set of wires at one end are connected with the Orange set of wires at another end and vice versa.

Question 2.
Write a short note on RJ45 connector?
Answer:
RJ45 Connector:

  1. The RJ45 connector is a small plastic cup which will be used to connect the wire inside the connector and ready to connect to the Internet.
  2. The RJ45 connector looks similar to a telephone jack but it looks slightly wider. The Ethernet cables are sometimes called RJ45 cables.
  3. In RJ45 the “RJ” stands for the Registered Jack and the “45” simply refers to the number of interface standards in the cable.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 3.
What are the differences between serial and parallel ports?
Answer:

Subject

Serial Port

parallel port

Pins 9 pins 25 pins
Type of port Male port Female Port
Color Usually Purple in color Usually Green in color
Data Transfer Rate Slower than Parallel Port Faster than Serial Port
Moving Bits Serial move bits inline, one at a time. Parallel moves bits next to each other
Usage of Wire Serial ports are only used 2 wires for transmitting and receiving data Parallel Port used 8 or more wire for trans­mitting and receiving data.

Question 4.
What is meant by a null modem cable?
Answer:
RS-232 cable is also used for interconnecting two computers without a modem. So it is also a null-modem cable. A cable interconnecting two devices directly are known as a null-modem cable.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 5.
What are the components involved in Ethernet cabling?
Answer:
The three main components are used in the Ethernet cabling components are

  1. Patch Cable (Twisted pair)
  2. RJ45 Connector
  3. Ethernet Ports
  4. Crimping Tool

Question 6.
What are the types of Fibre optic cables?
Answer:
There are two types of fiber optic cables available.

  1. One is single-mode (100BaseBx)
  2. Multimode (lOOBaseSX).
    • Single-mode cables are used for long-distance transmission and at a high cost
    • Multimode cables are used for short-distance transmission at a very low cost.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Part IV

Explain In Detail

Question 1.
What is meant by Registered Jack? Explain briefly the types of Jacks.
Answer:
Registered Jacks:

  • A Registered Jack commonly known as RJ is a network interface used for network cabling, wiring, and jack construction.
  • The primary function of the registered jack is to connect different data equipment and telecommunication devices.
  • The commonly known registered jacks are RJ-11, RJ-45, RJ-21, and RJ-28.
  • The registered jack refers to the male physical connector (Plug), a female physical connector (Jack) and it’s the wiring.

RJ-11:

  • It is the most popular modern form of the registered jack.
  • It is found in the home and office.
  • This registered jack is mainly used in telephone and landlines.
  • There are 6 pins where
    • The two pins give the transmission configuration,
    • The two pins give the receiver configuration and
    • The other two pins will be kept for reserved.
    • The two pin will have the positive terminal and the negative terminal.

RJ-14 and RJ-61:

  • The RJ-14 is the same as RJ-11 which will be used for telephone lines where same it as 6 pins whereas the RJ-61 will have 8 pins.
  • This RJ-61 will use the twisted pair cable with a modular connection.

RJ-21:

  • The RJ-21 connector has 50 pins with 25 pins at one end and 25 pins at the other end.
  • It is also called as champ connector or Amphenol connector.
  • The Amphenol is a connector manufacturer.
  • The RJ-21 interface is typically used for data communication trucking applications.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 2.
Explain wiring techniques used in Ethernet cabling.
Answer:

  • There are three types of wiring techniques to construct the Ethernet cable.
  • It is also known as color coding techniques. They are
    • Straight-Through Wiring
    • Cross-over Wiring
    • Roll-over Wiring

Straight-Through Wiring

  • In general, the Ethernet cables used for Ethernet connections are “straight through cables”.
  • These cable wires are in the same sequence at both ends of the cable, which means that pin 1 of the plug on one end is connected to pin 1 of the plug on the other end (for both standard – T568A & T568B).
  • The straight through wiring cables are mostly used for connecting PC / NIC card to a hub.
  • This is a simple physical connection used in printers, computers and other network interfaces.

Cross-over Wiring

  • Crossover cable is used to to connect two com¬puters or Ethernet devices directly together without a hub.
  • The pairs(Tx and Rx lines) will be crossed which means pin 1 & 2 of the plug on one end are connected with pin 3 & 6 of the plug on other end, and vice versa (3 & 6 to pin 1 & 2).
  • The Null modem Cables are the example of the crossover cables.

Roll-over Wiring

  • Rollover cable is a type of null-modem cable that is often used to connect a device console port to make programming changes to the device.
  • The rollover wiring have opposite pin arrangements, all the cables are rolled over to different arrangements.
  • In the rollover cable, the colored wires are reversed on other end i.e. the pins on one end are connected with other end in reverse order.
  • Rollover cable is also known as Yost cable or Console cable. It is typically flat (and light blue color) to distinguish it from other types of network cabling.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 3.
Explain about RJ45 connector.
Answer:

  • The RJ45 connector is a small plastic cup which will be used to connect the wire inside the connector and ready to connect the Internet.
  • The RJ45 connector looks similar like a telephone jack but it looks a slightly wider.
  • The Ethernet cables are sometime called as RJ45 cables.
  • In RJ45 the “RJ” stands for the Registered Jack and the “45” simply refers to the number of interface standard in the cable.
  • Each RJ45 connector has eight pins and connected to each end of the Ethernet cable, since it has 8-position, 8-contact (8P8C) modular plug,
  • It is also known as 8P8C connector. These plugs (connector) are then inserted into Ethernet port of the network card.

Wiring schemes and color codes of the connector

  • The RJ45 connector has eight small jack inside to connect eight small wires of the patch cable.
  • The eight cables are in eight different colors. Let’s discuss that eight colors and where does that eight colors connect to the RJ45 connector.
  • Wiring schemes specifies how the wires to be connected with RJ45 connector. There are two wiring schemes available to terminate the twisted-pair cable on each end, which are T-568A and T-568B.
  • Although four pairs of wires are available in the cable, Ethernet uses only two pairs: Orange and Green. The other two colors (blue and brown) can be used ISDN or phone connections.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 4.
Explain the components used in Ethernet cabling.
Answer:

The main components are used in the Ethernet cabling are

  1. Patch Cable (Twisted pair)
  2. RJ45 Connector
  3. Ethernet Ports
  4. Crimping Tool

1. Patch Cable (Twisted Pair):
1. These Cables are generally made up of 8 wires in different colors.

2. Four of them are solid colours, and the others are striped.
3. The eight colors are white green, green, white orange, blue, white blue, orange, white brown and brown. The following figure 13.8 shows the patch cable.
Ethernet cables are normally manufactured in several industrial standards such as Cat 3, Cat 5, Cat 6, Cat 6e and cat 7. “Cat” simply stands for “Category,”. Increasing the size of the cable also lead to slower transmission speed.

4. The cables together with male connectors (RJ45) on each end are commonly referred as Ethernet cables. It is also called as RJ45 cables, since Ethernet cable uses RJ45 connectors.

2. RJ45 Connector:

  • The RJ45 connector is a small plastic cup which will be used to connect the wire inside the connector and ready to connect the Internet.
  • The RJ45 connector looks similar like a telephone jack but it looks a slightly wider.
  • The Ethernet cables are sometime called as RJ45 cables.
  • In RJ45 the “RJ” stands for the Registered Jack and the “45” simply refers to the number of interface standard in the cable.
  • Each RJ45 connector has eight pins and connected to each end of the Ethernet cable.
  • Since it has 8-position, 8-contact (8P8C) modular plug, It is also known as 8P8C connector. Th£se plugs (connector) are then inserted into Ethernet port of the network card.

3. Ethernet card and Port:

  • Ethernet card is a Network Interface Card (NIC) that allows computers to connect and transmit data to the devices on the network. It may be an expansion card or built-in type.
  • Expansion card is a separate circuit board also called as PCI Ethernet card which is inserted into PCI slot on motherboard of a computer.
  • Now a days most of the computers come with built-in Ethernet cards which resides on motherboard.
  • Wireless Ethernet cards are also available, which uses radio waves to transmit data.
  • Ethernet port is an opening which is a part of an Ethernet card. It accepts RJ45 connector with Ethernet cable. It is also called as RJ45 jack. It is found on personal computers, laptops, routers, switches, hubs and modems.
  • In these days, most of the computers and laptops have a built-in Ethernet port for connecting the device to a wired network.

4. Crimping Tool:

  • Crimping is the process of joining two or more pieces of metal or wire by deforming one or both of them to hold each other.
  • A crimping tool is a physical tool which is used to connect the patch wire and the Ethernet connector.
  • The tool will puncture the connector and makes the wire set in the connector.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 5.
Explain the type of Network cables?
Answer:
There are many types of cables available in networking. Here we discuss six different cables.
1. Coaxial Cables:

  • This cable is used to connect the television sets to home antennas and transfer the information in 10 Mbps,
  • It is divided into thinnet and thicknet cables.
  • These cables have a copper wire inside and insulation Is covered on the top of the copper wire to provide protection to the cable.
  • These cables are very difficult to install and maintain because they are too big to carry and replace.
  • The coaxial cable got its name by the word “coax”. Nowadays coaxial cables are also used for dish TV where the setup box and the television is connected using the coaxial cable only.
  • Some of the cable names are Media Bridge 50-feet Coaxial cable, Amazon basics CL2- Rated Coaxial cables, etc.

Twisted Pair Cables:

  • It is type of cable with two or more insulated wires twisted together.
  • It started with the speed of 10 Mbps (10BASE-T cable is used).
  • Then the cable is improved and the speed was higher and went to 100 Mbps and the cable was renamed 100BASE-TX.
  • Then finally the cable improved more made to 10 Gbps and named as 10GBASE-T.
  • This twisted cable has 8 wires which are twisted to ignore electromagnetic interference.
  • Also, the eight wires cannot be placed in a single unit there could be a difficulty in spacious, so it is twisted to make as one wire.
  • There are two types of twisted pair cables, Unshielded Twisted Pair (UTP) and Shielded Twisted pair (STP).
  • The UTP is used nowadays as modern cables for the Internet and they are lower in cost and installation and maintenance is easy compared to the coaxial cables.
  • STP is similar to UTP, but it is covered by an additional jacket to protect the wires from External interference.

Fiber Optics:

  • This cable is different from the other two cables.
  • The other two cables had an insulating material on the outside and the conducting material like copper inside.
  • But in this cable it is of strands of glass and pulse of light is used to send the information.
  • They are mainly used in Wide Area Network (WAN)/The WAN Is a network that extends to the very large distance to connect the computers,

Ethernet Cables:

  • Ethernet cable is the most common type of network cable mainly used for connecting the computers or devices at home or office.
  • This cable connects wired devices within the local area network (LAN) for sharing the resources and accessing the Internet.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

12th Computer Applications Guide Network Cabling Additional Important Questions and Answers

Part A

Choose The Correct Answers:

Question 1.
Which year were the co-axial cables invented?
(a) 1880
(b) 1890
(c) 1990
(d) 2000
Answer:
(a) 1880

Question 2.
The latest version of USB is ………………
a) 2.0
b) 4.0
c) 5.0
d) 3.0
Answer:
d) 3.0

Question 3.
Co-axial cables transfer the information in …………………………
(a) 10 kbps
(b) 10 Mbps
(c) 10 GBPS
(d) 10 TBPS
Answer:
(b) 10 Mbps

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 4.
……………….. cable connects wired devices within the local area network for sharing the resources and accessing the Internet.
a) wireless Cable
b) Ethernet cable
c) Coaxial Cable
d) Twisted Wire
Answer:
d) Twisted Wire

Question 5.
Co-axial cables are made up of ……………………..
(a) Steel
(b) Iron
(c) Copper
(d) Aluminium
Answer:
(c) Copper

Question 6.
………….. are used for connecting the television with the setup box.
a) UTP
b) STP
c) Twisted Cable
d) Coaxial cables
Answer:
d) Coaxial cables

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 7.
…………………….. is a type of cable with two or more insulated wires twisted together.
Answer:
Twisted pair cables

Question 8.
The ……………. uses light to transmit the information from one place to another.
a) Fibre cable
b) Network cable
c) optic cable
d) None of these
Answer:
c) optic cable

Question 9.
Assertion (A): 8 wires of the twisted cable are twisted
Reason (R): To ignore electromagnetic interference.
(a) A is true R is the reason
(b) A, R both false
(c) A is false R is true
(d) A is true, R is not the reason
Answer:
(a) A is true R is the reason

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 10.
…………….. are used for long-distance transmission and at a high cost.
a) optic cable
b) Network cable
c) Multimode cable
d) Single-mode cables
Answer:
b) Network cable

Question 11.
STP stands for ………………………
(a) Shielded Turn paper
(b) Shielded Twisted pair
(c) Soft Turn Photo
(d) Short Time processing
Answer:
(b) Shielded Twisted pair

Question 12.
The serial port will send ………….. at one time.
a) 2 bit
b) Null
c) 1 bit
d) 5 bit
Answer:
c) 1 bit

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 13.
Find the wrongly matched pair.
(a) coaxial cables – TV
(b) Twisted pair cables – ATP, UTP
(c) Fiber optic cables – Single-mode, Multimode
Answer:
(b) Twisted pair cables – ATP, UTP

Question 14.
The Null modem Cables are an example of the crossover cables.
a) coaxial
b) crossover cables
c) parallel cables
d) Serial cable
Answer:
b) crossover cables

Question 15.
The ……………. is the basic component of the Local Area Network(LAN)
a) parallel cables
b) Serial cable
c) coaxial
d) Ethernet cable
Answer:
d) Ethernet cable

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 16.
The two types of fiber optic cables are ……………………… and ………………………..
Answer:
Single-mode, Multi-mode

Fill In The Blanks

1. The …………… is a small plastic cup which will be used to connect the wire inside the connector and ready to use to connect the Internet.
Answer:
RJ45 Ethernet connector

2. The ………….. has eight small pins inside to connect eight small wires in the patch cable. The eight cables have eight different colours.
Answer:
RJ45 connector

3. The …………….. is the jack where the Ethernet cable is to be connected.
Answer:
Ethernet port

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

4. …………….. port will be there in both the computers and the LAN port.
Answer:
Ethernet port

5. The …………… is a physical tool which is used to connect the patch wire and the Ethernet connector(RJ45).
Answer:
crimping tool

6. A ……………. is a network interface used for connecting different data equipment and telecommunication devices.
Answer:
Registered Jack (RJ)

7. ……………… jack is mainly used in telephone and landlines.
Answer:
RJ11

8. ……………… cable is used to transfer the information in 10 Mbps.
Answer:
Coaxial

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Very Short Answers

Question 1.
What is the purpose of network cables?
Answer:
The Network cables are used to transfer the data and information to another computer.

Question 2.
What is the use of coaxial cable?
Answer:
Coaxial cables are used for connecting the television with the setup box.

Question 3.
How many wires are there in the twisted cable? Why?
Answer:
Twisted cable has 13 wires which are twisted to ignore electromagnetic interference

Question 4.
What are the two types of twisted pair cables?
Answer:
Unshielded Twisted Pair (UTP) and Shielded Twisted pair (STP).

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 5.
Expand ARPANET.
Answer:
Advanced Research Project Agency Network

Question 6.
What is ARPANET?
Answer:
It is the predecessor of the modern Internet.

Question 7.
What is the use of USB cables?
Answer:
USB cables are used to connect keyboard, mouse, and other peripheral devices

Question 8.
What is the use of parallel cables?
Answer:
The parallel cables are used to connect to the printer and other disk drivers.

Question 9.
What are the two types of fiber-optic cable?
Answer:
Single-mode ((100 Base Bx)) and Multimode ((100 Base SX))

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 10.
How serial port and parallel port differ?
Answer:
It will send 1 bit at one time whereas the parallel port will send 13 bit at one time.

Question 11.
What is the use of serial and parallel interface?
Answer:
The Serial and Parallel interface cables are used to connect the Internet to the system.

Question 12.
What is the purpose of cross-over cable?
Answer:
Cross over cable is used to join two network devices of the same type

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 13.
What is RJ Network?
Answer:
A Registered Jack (RJ) is a network interface

Question 14.
Where is the RJ11 cable used?
Answer:
RJ11 jack is mainly used in telephone and landlines

Question 15.
What is the use of a crimping tool?
Answer:
The crimping tool is used to connect the patch wire and the Ethernet connector.

Question 16.
What is an Ethernet port?
Answer:
The Ethernet port is the jack where the Ethernet cable is to be connected.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 17.
What is an Ethernet cable?
Answer:
The Ethernet cable is the basic component of the Local Area Network

Question 18.
What is the purpose of using Fiber optic cable?
Answer:
Fiber optic cables are used in Wide Area Network (WAN).

Question 19.
What is a dongle?
Answer:
The dongle is a small peripheral device which has compatible with mobile broadband.

Question 20.
How the internet is connected through a dongle?
Answer:
A sim slot in it and connects the Internet and acts as a modem to the computer.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Abbreviation:

  1. ARPANET – Advanced Research Project Agency Network
  2. WWW – World Wide Web
  3. W3C – World Wide Web Consortium
  4. LAN – Local Area Network
  5. WAN – Wide Area Network
  6. UTP – Unshielded Twisted Pair
  7. STP – Shielded Twisted pair
  8. NIC – Network Interface Card
  9. USB – Universal Serial Bus
  10. RJ – Registered Jack
  11. 8P8C – 8-position, 8-contact

Find The Odd One On The Following

l. (a) Media Bridge
(b) 50feet coaxial cable
(c) 10BASE-T
(d) CL2
Answer:
(c) 10BASE-T

2. (a) 100BaseBX
(b) 100BaseSX
(c) WAN
(d) 10 Base T
Answer:
(d) 10 Base T

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

3. (a) Keyboard
(b) Monitor
(c) Mouse
(d) peripheral devices
Answer:
(b) Monitor

4. (a) Smartphones
(b) GPS devices
(c) Digital cameras
(d) Mouse
Answer:
(d) Mouse

5. (a) Speakers
(b) Infra Red
(c) Blue tooth
(d) WiFi
Answer:
(a) Speakers

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

6. (a) RJ45Connector
(b) UTP Cable
(c) coaxial cable
(d) plastic covering
Answer:
(c) coaxial cable

7. (a) USB cable
(b) RJ45 Connector
(c) Ethernet Ports
(d) Crimping Tools
Answer:
(a) USB cable

8. (a) White Green
(b) White Red
(c) White Orange
(d) White brown
Answer:
(b) White Red

9. (a) Cat 5
(b) Cat 6e
(c) Cat 7
(d) Cat 5e
Answer:
(d) Cat 5e

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

10. (a) RJ-11
(b) RJ-21
(c) RJ-08
(d) RJ-45
Answer:
(c) RJ-08

11. (a) Registered Jack
(b) Mobile
(c) 6pin
(d) Landlines
Answer:
(b) Mobile

12. (a) ChampConnector
(b) Amphenol Connector
(c) Wireless Connector
(d) RJ21
Answer:
(c) Wireless Connector

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

13. (a) Champ over
(b) Cross Over
(c) Straight Through
(d) Roll Over
Answer:
(a) Champ over

14. (a) T568A
(b) T568B
(c) Tx, Rx lines
(d) RJ-28
Answer:
(d) RJ-28

15. (a) Twisted pair
(b) UTP
(c) FTP
(d) STP
Answer:
(c) FTP

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Choose The Incorrect Pair:

1. a) Media Bridge 50-feet Coaxial cable, Amazon basicsCL2-Rated Coaxial cables.
b) Unshielded Twisted Pair and Shielded Twisted pair.
c) USB cables and Parallel cables
d) Single-Mode and Multimode
Answer:
c) USB cables and Parallel cables

2. a) Serial and Parallel cables
b) Patch Cable, RJ45 Connector
c) Ethernet Ports, Crimping Tool
d) Coaxial cable, Serial Port
Answer:
d) Coaxial cable, Serial Port

3. a) Ethernet cable and serial cable
b) RJ45 plug, Ethernet connector.
c) Rj45 jack, Ethernet Port
d) RJ45, 802.3
Answer:
a) Ethernet cable and serial cable

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

4. a) RJ-11, RJ-45
b) RJ-45 and RJ47
c) RJ-14 and RJ-61
d) RJ-21, RJ-28
Answer:
b) RJ-45 and RJ47

5. a) USB cables, Peripheral devices
b) Coaxial cables, 10 Mbps
c) Ethernet port, LAN port
d) Parallel port, 100BaseSX
Answer:
d) Parallel port, 100BaseSX

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Match The Following:

Question 1.
A) Tim Berners Lee -1) WAN
B) Coaxial cables – 2) WWW
C) Twisted pair – 3) CL2 Related coaxial
D) Fiber optics cable – 4) STP
a) 1 2 3 4
b) 2 31 4
c) 4 3 2 1
d) 2 3 4 1
Answer:
d) 2 3 4 1

Question 2.
A) Coaxial cables – 10gbps
B) Twisted pair – 100 BASE-BX
C) Fiber optics cable – 100 GBASE-T
D) Ethernet Cable -10 Mbps
a) 1 2 3 4
b) 2 31 4
c) 4 3 2 1
d) 2 3 4 1
Answer:
c) 4 3 2 1

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 3.
A) RJ45 connector -1) Crimping Tool
B) Ethernet -2) Small 8 jack inside
C) Expansion card -3) NIC
D) RJ45 Cable -4) Ethernet cable
a) 1234
b) 2 31 4
c) 4 3 2 1
d) 2 3 4 1
Answer:
d) 2 3 4 1

Question 4.
A) Ethernet Technology – RJ45, 802.3
B) RJ45 Connector(male) – RJ45 plug, Ethernet connector, 8P8C connector
C) RJ45 socket (female) – Rj45 jack, Ethernet Port
D) RJ45 Cable – Ethernet cable
a) 1 2 3 4
b) 2 31 4
c) 4 3 2 1
d) 2 3 4 1
Answer:
a) 1 2 3 4

Question 5.
A) RJ11 Jack – Peripheral devices
B) RJ45 Connector – Telephones and landlines
C) USB Cables – Crimping Tool
D) Cross over cable – Null modem Cables
a) 1 2 3 4
b) 2 31 4
c) 4 3 2 1
d) 2 3 4 1
Answer:
b) 2 31 4

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Part B

Short Answers

Question 1.
Write a note on coaxial cables?
Answer:
Coaxial Cables:
This cable was invented in the late 1880s, which is used to connect television sets to home antennas. This cable is used to transfer the information in 10 Mbps.

Question 2.
What is mean by Expansion card?
Answer:

  • The expansion card is a separate circuit board also called PCI.
  • Ethernet card is inserted into a PCI slot on the motherboard of a computer.

Question 3.
Mention the different types of cables used to connect the computer on Network?
Answer:
Computers can be connected on the network with the help of wired media (Unshielded Twisted pair, shielded Twisted pair, Co-axial cables, and Optical fiber) or wireless media (Infra Red, Bluetooth, WiFi)

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 4.
List the type of Network cables
Answer:

  1. Coaxial Cables
  2. Twisted Pair Cables
  3. Fiber Optics
  4. USB Cables
  5. Serial and Parallel cables
  6. Ethernet Cables

Question 5.
Give the Pin details of RJ-11?
Answer:
Pin details of the RJ-11, there is 6 pin where the two pins give the transmission configuration, the two pins give the receiver configuration and the other two pins will be kept for reserved. The two-pin will have the positive terminal and the negative terminal.

Question 6.
What are the two types of twisted-pair cables?
Answer:
There are two types of twisted pair cables,

  1. Unshielded Twisted Pair (UTP) and
  2. Shielded Twisted pair (STP).

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 7.
What is the use of UTP?
Answer:

  • The UTP is used nowadays as modern cables for the Internet and they are lower in cost and installation and maintenance is easy compared to the coaxial cables.
  • STP is similar to UTP, but it is covered by an additional jacket to protect the wires from External interference.

Question 8.
Write about Fiber Optics
Answer:

  • Fiber Optics cable is different from the other two cables.
  • The other two cables had an insulating material at the outside and the conducting material like copper inside.
  • But in this cable it is of strands of glass and pulse of light is used to send the information.

Question 9.
What are the two types of fiber optic cables available,
Answer:
There are two types of fiber optic cables available

  1. Single-mode (100BaseBx) another
  2. Multimode (100BaseSX).

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Question 10.
What is the use of a Single-mode Cable?
Answer:
Single-mode cables are used for long-distance transmission and at a high cost.

Question 11.
What is the use of Multi-Mode Cable?
Answer:

  • Multimode cables are used for short-distance transmission at a very low cost.
  • The optic cables are easy to maintain and install.

Question 12.
What is the use of Micro USB?
Answer:
Micro USB is a miniaturized version of the USB used for connecting mobile devices such as smartphones, GPS devices, and digital cameras.

Question 13.
What is the use of cross-over Cable?
Answer:
Cross over cable is used to join two network devices of the same type for example two PCs or two network devices.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Part C

Explain In Brief Answer

Question 1.
Compare UTP and STP?
Answer:
UTP: The UTP is used nowadays as modem cables for the Internet and they are lower in cost and installation and maintenance is easy compared to the coaxial cables.

STP: STP is similar to UTP, but it is covered by an additional jacket to protect the wires from External interference.

Question 2.
How to determine the type of Ethernet Cable?
Answer:

  1. Straight-through: The coloured wires are in the same sequence at both ends of the cable.
  2. Cross-over: The first coloured wire at one end of the cable is the third coloured wire at the other end of the cable.
  3. Poll-over: The coloured wires are in the opposite sequence at either end of the cable.

Samacheer Kalvi 12th Computer Applications Guide Chapter 13 Network Cabling

Part D

Explain In Detail

Question 1.
Explain the Crimping process to make Ethernet cables?
Answer:
Crimping process for making Ethernet cables

  1. Cut the cable with the desired length
  2. Strip the insulation sheath about 1 inch from both ends of the cable and expose the Twisted pair of wires
  3. After stripping the wire, untwist the smaller wires and arrange them into the proper wiring scheme, T568B preferred generally.
  4. Bring the wires tighter together and cut them down so that they all have the same length ( Vi inch).
  5. Insert all 8 coloured wires into the eight grooves in the connector. The wires should be, inserted until the plastic sheath is also inside the connector.
  6. Use the crimping tool to lock the RJ45 connector on the cable. It should be strong enough to handle manual traction. Now it is ready for data transmission.
  7. Use a cable tester to verify the proper connectivity of the cable, if need.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Tamilnadu State Board New Syllabus Samacheer Kalvi 12th Computer Applications Guide Pdf Chapter 14 Open Source Concepts Text Book Back Questions and Answers, Notes.

Tamilnadu Samacheer Kalvi 12th Computer Applications Solutions Chapter 14 Open Source Concepts

12th Computer Applications Guide Open Source Concepts Text Book Questions and Answers

Part I

Choose The Correct Answers

Question 1.
If the source code of a software is freely accessible by the public, then it is known as
a) freeware
b) Firmware
c) Open source
d) Public source
Answer:
c) Open source

Question 2.
Which of the following is a software pro¬gram that replicates the functioning of a computer network?
a) Network software
b) Network simulation
c) Network testing
d) Network calculator
Answer:
b) Network simulation

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
Which of the following can document every incident that happened in the simulation and are used for examination?
a) Net Exam
b) Network hardware
c) Trace file
d) Net document
Answer:
c) Trace file

Question 4.
Which is an example of network simulator?
a) simulator
b) TCL
c) Ns2
d) C++
Answer:
c) Ns2

Question 5.
Fill in the blanks: NS2 comprises of key languages?
a) 13
b) 3
c) 2
d) 4
Answer:
c) 2

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 6.
Choose the Correct Pair from the following to build NS2
a) UNIX & TCL
b) UNIX & C++
c) C++ & OTCL
d) C++ & NS2
Answer:
c) C++ & OTCL

Question 7.
Which of the following is not a network simulation software?
a) Ns2
b) OPNET
c) SSFNet
d) C++
Answer:
a) Ns2

Question 8.
Which of the following is a open source network monitoring software?
a) C++
b) OPNET
c) Open NMS
d) OMNet++
Answer:
c) Open NMS

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 9.
Open NMS was released in
a) 1999
b) 2000
c) 2003
d) 2004
Answer:
d) 2004

Question 10.
OpenNMS Group was created by
a) Balog
b) Matt Brozowski
c) David Flustace
d) All of them.
Answer:
d) All of them.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Part II

Short Answers

Question 1.
Explain the History of open-source software.
Answer:
History of open source software:

  1. In the early day of computing, programmers and developers shared software in order to learn from each other
  2. Eventually, it moved to the wayside of commercialization of software in 1970-1980
  3. The Netscape communication corporation released their popular Netscape Communicator Internet suite as free software. This made others look into how to bring the free software ideas.
  4. The Open Source Initiative was founded in Feb 1998 to encourage the use of the new term open-source.

Question 2.
What is meant by a network simulator?
Answer:

  • A network simulator is a software program that replicates the functioning of a computer network.
  • In simulators, the computer network is typically demonstrated with devices, traffic etc. and the performance is evaluated.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
What is a trace file?
Answer:
A significant output of the simulation is the trace files. Trace files can document every incident that happened in the simulation and are used for examination.
C++ and Object-oriented Tool Command Language (OTCL) and network monitoring.

Question 4.
Write short notes on NS2.
Answer:
NS2 is the abbreviation of NETWORK SIMULA-TOR version 2. NS2 has C++ and Object-oriented Tool Command Language (OTcl) of languages 2. It is one the open-source application software

Question 5.
Explain NRCFOSS.
Answer:
NRCFOSS: National Resource Centre for Free and Open Source Software an Institution of Government of India. To help in the development of FOSS in India.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 6.
Write a short note on Open NMS?
Answer:
There are two types in this Meridian and Horizon.

  • Meridian: When we need stability and long-term support choose Meridian which is best for Enterprises as well as businesses.
  • Horizon: Horizon used where innovation occurs frequently. It is Best for IT-ecosystem, new technologies monitoring.

Part III

Explain In Brief Answer

Question 1.
What are the uses of Open source Network Software?
Answer:

  • There are many opensource softwares, so, we can select and use any software that suits our needs.
  • The software can be used without any cost and restrictions.
  • We can share our ideas with the team.
  • We can learn many ideas and make our program writing skills more efficient.
  • We can add the most required features to the software User friendly.

Question 2.
Explain Free software.
Answer:
Free software a concept developed in the 1980s by an MIT computer science researcher, Richard Stallman is defined by four conditions, as outlined by the nonprofit Free Software Foundation.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
List out the Popular open-source software.
Answer:

  • NS2 , OPEN NMS, Ubuntu , MySQL, PDF Creator, Open Office, 7zip, GnuCash, GIMP, BLENDER,
  • AUDACITY, VLC, MOZILAi FIREFOX, MAGENTO, ANDROID, PHP

Question 4.
Write note on open source hardware.
Answer:
In this period of increased competition and cyber crimes, the computers used by indivudals or business organisations may have spy hardwares of rivals. Open source hardware technology helps in such threats. In this technique we get the components of the hardware and its circuit diagram, so that we can remove suspicious spyware if found.

Question 5.
What are the main functional areas of Open NMS?
Answer:

  1. Service monitoring, where a number of monitor modules can govern if network-based services (ICMP, HTTP, DNS, etc.) are accessible.
  2. Data Gathering by using SNMP and JMX.
  3. Event management and notifications, which comprises alarm reduction and a robust announcement system with accelerations and duty schedules.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 6.
Explain Types of Organizations related to Open Source.
Answer:

  1. Organizations related to Open Source
  2. Apache Software Foundation
  3. The Document Foundation The Eclipse Foundation
  4. Free Software Foundation
  5. Linux Foundation
  6. OpenCourseWare Consortium
  7. Open Source Initiative

Part IV

Explain In Detail

Question 1.
Differentiate Proprietary and open-source software.
Answer:

                      Open Source Software

Proprietary Software

It is developed and tested through open collaboration It is owned by the indi­vidual or the organiza­tion that developed if
Anyone with the aca­demic knowledge can access, inspect, modi­fy and redistribute the source code. Only the owner or pub­lisher who holds the legal property rights of the source code can ac­cess it.
The project is managed by an open-source community of develop­ers and programmers The project is managed by a dosed group of in­dividuals or a team that developed it
They are not aimed at unskilled users outside of the programming community There are focused on a limited market of both skilled and unskilled end users
It Provides better flex­ibility which means more freedom which encourages innovation There is a very limit­ed scope of innovation with the restrictions and all
Example; Android, Firefox etc Example: Windows, macOS

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 2.
List out the Benefits of Open Source Software.
Answer:
There are many open source softwares, so, we can select and use any software that suits our needs.

  • The complete options of the software can be used without any cost and restrictions.
  • We can share our ideas with the team, write the required code and share it with many.
  • As we can identify the programming techniques of group members, we can learn many ideas and make our program writing skills more efficient.
  • The coding in open source softwares is being groomed by many enthusiastic members of the group. So if we report problems that we have in the program they are quickly mended by the group’s effort.
  • As we can make changes to the open-source softwares, we can add the most required features in the software.
  • Much open-source software is very user friendly.

Question 3.
Explain various Open Source Licenses.
Answer:
Types of open source license

  1. Apache License 2.0
  2. BSD 3-Clause “New” or “Revised” license
  3. BSD 2-Clause “Simplified” or “FreeBSD” license
  4. GNU General Public License (GPL)
  5. GNU Library or “Lesser” Genera! Public License (LGPL)
  6. MIT license
  7. Mozilla Public License 2.0
  8. Common Development and Distribution License
  9. Eclipse Public License
  10. When you change the source code. OSS requires the inclusion, of what you altered as well as your methods.
  11. The software created after code modifications may or may not be made available for free.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

12th Computer Applications Guide Open Source Concepts Additional Important Questions and Answers

Part A

Choose The Correct Answers:

Question 1.
…………… software has been developed by a variety of programmers.
a) Open source
b) Free Software
c) Proprietary’ Software
d) All of these
Answer:
a) Open source

Question 2.
Proprietary Software is owned by an …………………………
(a) Organization
(b) Individual
(c) both a and b
(d) none of these
Answer:
(c) both a and b

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
Which of the following organization is not related to Open Source?
a) Apache Software Foundation
b) The Document Foundation
c) The Eclipse Foundation
d) Initiative Foundation.
Answer:
d) Initiative Foundation.

Question 4.
The free software concept is developed in ……………
a) 1980s
b) 1970s
c) 1990s
d) None of the above
Answer:
a) 1980s

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 5.
Pick the odd one out
(a) Apache Software Foundation
(b) The document Foundation
(c) The Eclipse Foundation
(d) The round Foundation
Answer:
(d) The round Foundation

Question 6.
Which of the following is not an open-source application?
a) AUDACITY
b) VLC
c) Mozilla Firefox
d) MS Office
Answer:
d) MS Office

Question 7.
BOSS developed by ……………………..
(a) A-DAC
(b) M-DAC
(c) D-MAC
(d) C-DAC
Answer:
(d) C-DAC

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 8.
…………… a pure event base software tool with super simulation design
a) OpenNMS
b) API
c) NS2
d) OTCL
Answer:
b) API

Question 9.
How many Indian Languages are supported by BOSS?
(a) 15
(b) 10
(c) 5
(d) many
Answer:
(d) many

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 10.
In OpenNMS, Data are Gathering by using ……………..
a) SNMP
b) JMX
c) Both a and b
d) None of these
Answer:
c) Both a and b

Question 11.
Which of the following is a network-based service?
a) ICMP
b) HTTP
c) DNS
d) All of the above
Answer:
d) All of the above

Question 12.
The free software was developed in the year …………………….
(a) 1972
(b) 1978
(c) 1980
(d) 2003
Answer:
(c) 1980

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Abbreviation

  1. NRCFOSS- National Resource Centre for Free and Open Source Software
  2. BOSS – Bharat Operating System Solutions
  3. C-DAC – Centre for Development of Advanced Computing
  4. GNU – General Public License
  5. FCAPS – Fault, configuration, accounting, performance, security
  6. NMS – Network Management System)
  7. OTCL – Object-oriented Tool Command Language
  8. SSFNet – Scalable Simulation Framework Net Models
  9. API – Application Program Interface
  10. SOURCE CODE – Set of Instructions that decide, how the software should work
  11. NS2 – Network Simulation 2
  12. OpenNMS – Open Source Network Management Software

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Assertion And Reason

Question 1.
Assertion (A): In a computer network, network simulation is a method whereby a software program models the activities of a network by calculating the communication between the different network objects such as(routers, nodes, switches, access points, links etc.).
Reason(R): A network simulator is a software program that replicates the functioning of a computer network.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:

Question 2.
Assertion (A): There is much Open Source software. So, we can select and use any software that suits our needs.
Reason(R): The complete options of the software can be used without any cost and restrictions.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
Assertion (A): Open NMS (Network Management System) is a free and open-source initiative grade network monitoring and management platform.
Reason(R); It is established and maintained by a community of users, developers and by the Open NMS Group, it offering services, training and support.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)

Question 4.
Assertion (A); Service monitoring, where a number of monitor modules can govern if network-based services (ICMP, HTTP, DNS, etc.) are accessible.
Reason(R): Data Gathering by using HTML and JSP.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
c) (A) is true and (R) is false

Question 5.
Assertion (A): AJAX has C++and Object-oriented Tool Command Language (OTCL) of languages
Reason(R): NS2 link together for C++ and the OTCL using TCLCL.
a) Both (A) and (R) are correct and (R) is the correct explanation of (A)
b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A)
c) (A) is true and (R) is false
d) (A) is false and (R) is true
Answer:
d) (A) is false and (R) is true

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Match The Following:
1. Richard Stallman – Software Program
2. BOSS – Open-source Application software
3. BSD 2-Clause – LGPL
4. BSD 3-Clause – Free software concept
5. GNU Library – Data Gathering
6. NS2 – Revised license
7. Open NMS – C++, OTCL
8. Network Simulation – FCAPS
9. BLENDER – Free BSD license
10. SNMP – C-DAC
Answers
1. Free software a concept
2. C-DAC
3. FreeBSD license
4. Revised license
5. LGPL
6. C++, OTCL
7. FCAPS
8. Software Program
9. Open source Application software
10. Data Gathering

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Very Short Answers

Question 1.
What is a trace file?
Answer:
Trace file is a document file, consists of every incident that happens in a simulation.

Question 2.
What is the use of Network monitoring software notifications?
Answer:
It is used to help the user or administrator for fixed errors.

Question 3.
Mention some large enterprise management products?
Answer:
HP Open View, IBM Micro muse or IBM Tivoli.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 4.
How NS2 links C++ and OTCL?
Answer:
It links together for C++ and the OTCL using TCLCL.

Question 5.
What is the use of trace files?
Answer:
Trace files can document every incident that happened in the simulation and are used for examination.

Question 6.
What does open-source denote?
Answer:
Open Source denotes some program whose I source code is made available for usage

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Find The Odd One On The Following

1. (a) Support
(b) Training
(c) Edit Source By User
(d) Security
Answer:
(c) Edit Source By User

2. (a) Apache
(b) Microsoft
(c) Linux
(d) Document
Answer:
(b) Microsoft

3. (a) GUI
(b) GPL
(c) LG PL
(d) MIT
Answer:
(a) GUI

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

4. (a) Routers
(b) Nodes
(c) OpenSource
(d) Access points
Answer:
(c) OpenSource

5. (a) Openoffice
(b) VLC
(c) Microsoft word
(d) NS2
Answer:
(c) Microsoft word

6. (a) Fault
(b) Communication
(c) Accounting
(d) Performance
Answer:
(b) Communication

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

7. (a) Event Management
(b) Service Monitoring
(c) Data Collection
(d) MAGENTO
Answer:
(d) MAGENTO

8. (a) ICMP
(b) HTTP
(c) JMX
(d) DNS
Answer:
(c) JMX

9. (a) Mozilla Firefox
(b) Chrome
(c) Internet Explorer
(d) Android
Answer:
(d) Android

10. (a) Bjarne Stroustrup
(b) Steve Giles
(c) Brian Weaver
(d) LukeRindfuss.
Answer:
(a) Bjarne Stroustrup

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Important Years To Remember:

1980 Free software concept developed
1999 Open NMS was released by Steve Giles, Brian Weaver, and Luke Rindfuss
2004 OpenNMS Group was created by Balog, Matt Brozowski, and David Hustace

Part B

Short Answers

Question 1.
Write a short note on open source software and developers?
Answer:
Open-Source Software and Developers:
OSS projects are collaboration opportunities that improve skills and build connections in the field. Domains that developers can contribute to the open-source community include:

  1. Communication tools.
  2. Distributed revision control systems.
  3. Bug trackers and task lists.
  4. Testing and debugging tools.

Question 2.
What is the network simulator?
Answer:

  • A network simulator is a software program that replicates the functioning of a computer network.
  • In simulators, the computer network is typically demonstrated with devices, traffic etc. and the performance is evaluated.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
Write a short note on BOSS.
Answer:

  • BOSS (Bharat Operating System Solutions) Operating System Developed in India by C-DAC (Centre for Development of Advanced Computing) Help to prompt the use of open-source software in India.
  • It Supports many Indian languages.

Part C

Explain In Brief Answer

Question 1.
Write some Organizations related to Open Source.
Answer:

  • Apache Software Foundation
  • The Document Foundation
  • The Eclipse Foundation
  • Free Software Foundation
  • Linux Foundation
  • Open Courseware Consortium
  • Open Source Initiative

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 2.
List the various types of open NMS?
Answer:
There are two types in this Meridian and Horizon.

  • Meridian: When we need stability and long-term support choose Meridian which is best for Enterprises as well as businesses.
  • Horizon: Horizon used where innovation occurs frequently. It is Best for IT-ecosystem, new technologies monitoring.

Question 3.
Write a short note on Open-Source Software and Developers
Answer:

  • OSS projects are collaboration opportunities that improve skills and build connections in the field.
  • Domains that developers can contribute to the open-source community include:
    • Communication tools.
    • Distributed revision control systems.
    • Bug trackers and task lists.
    • Testing and debugging tools.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Part D

Explain In Detail

Question 1.
Differentiate Open Source Software with free software?
Answer:
Open-Source Software vs. Free Software:
Although the terms are often used interchangeably, OSS is slightly different from free software. Both deal with the ability to download and modify software without restriction or charge.

However, free software a concept developed in the 1980s by an MIT computer science researcher, Richard Stallman is defined by four conditions, as outlined by the nonprofit Free Software Foundation. These “four freedoms” emphasize the ability of users to use and enjoy software as they see fit.

In contrast, the OSS criteria, which the Open Source Initiative developed a decade later, place more emphasis on the modification of software, and the consequences of altering source code, licensing, and distribution.

Obviously, the two overlap; some would say the differences between OSS and free software are more philosophical than practical. However, neither should be confused with freeware. Freeware usually refers to proprietary software that users can download at no cost, but whose source code cannot be changed.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 2.
Explain in detail about Open NMS.
Answer:

  • Open NMS (Network Management System) is a free and open-source initiative-grade network monitoring and management platform.
  • It is established and maintained by a community of users, developers, and the Open NMS Group.
  • It offering services, training, and support.

The goal is for Open NMS

  • The goal is for Open NMS to be an actually distributed, scalable management application platform for all features of the FCAPS (Fault, Configuration, Accounting, Performance, Security) network management model.
  • Presently the emphasis is on Fault and Performance Management.
  • It was intended to cope with tens of thousands of devices from a single server as well as achieve unlimited devices using a cluster of servers.

Features:

  • OpenNMS comprises a discovery engine to routinely configure and manage network devices without operator intervention. It is written in Java and is issued under the GNU (General Public License.)
  • OpenNMS is the World’s first software for Network monitor and management with open-source options.

OpenNMS- Types:
There are two types in this Meridian and Horizon.
Meridian: When we need stability and long-term support choose Meridian which is best for Enterprises as well as businesses.
Horizon:

  • It is used where innovation occurs frequently.
  • It is Best for IT-ecosystem, new technology monitoring.

History:

  • OpenNMS was Released in 1999 by Steve Giles, Brian Weaver, and Luke Rindfuss.
  • In 2004 OpenNMS Group was created by Balog, Matt Brozovvski, and David Hustace.
  • It is written in Java and can run on all type of platform,
  • It gives us Event management & Notification, Discovery & Provisioning, service monitoring, and Data Collection.
  • Won lot of awards for best of open-source software.

Samacheer Kalvi 12th Computer Applications Guide Chapter 14 Open Source Concepts

Question 3.
Explain in Detail Open NMS?
Answer:
Open NMS

  • Open NMS (Network Management System)is a free and open-source initiative-grade network monitoring and management platform.
  • It is established and maintained by a community of users, developers, and by the Open NMS
    Group, it offering services, training, and support.
  • The goal is for Open NMS to be an actually distributed, scalable management application platform for all features of the FCAPS (Fault, configuration, accounting, performance,
    security) network management model.
  • Presently the emphasis is on Fault and Performance Management.
    It was intended to cope with tens of thousands of devices from a single server as well as achieve unlimited devices using a cluster of servers.
  • Open NMS comprises a discovery engine to routinely configure and manage network devices without operator intervention.
  • It is written in Java and is issued under the GNU (General Public License.)
  • Open NMS is the Worlds first software for Network monitor and management with open source options. There are two types in this Meridian and Horizon.
  • When we need stability and long-term support choose Meridian which is best for Enterprises as well as businesses, for Horizon used where innovation occurs frequently. It is Best for IT-ecosystem, new technologies monitoring.

Open Source Hardware:

  1. Remix
  2. Remake
  3. Remanufacture
  4. Redistribute
  5. Resell
  6. Study and Learn