Introduction to Loops | Chapter 4 |  Class 10 Computer Science 571(NCERT) Question and Answer | Class 10 Computer Science 571(NCERT) Question and Answer Solutions English Medium |


Introduction to Loops

Chapter 4


Questions:

1. Why do we use a loop in a C Program ?

আমি চি প্ৰ'গ্ৰাম এটাত লুপ কিয় ব্যৱহাৰ কৰোঁ?

Ans: In C programming, there are three loops: for loops, loop vial loop and vial. Loops in C can also be combined with other control statements such as brake statements, goto statements, and control statements.

(চি প্ৰ'গ্ৰামিংত, তিনিটা লুপ আছে: লুপ, লুপ ভাইল লুপ আৰু ভাইলৰ বাবে। চি-ত লুপবোৰ অন্যান্য নিয়ন্ত্ৰণ বিবৃতি যেনে ব্ৰেক ষ্টেটমেণ্ট, গোটো ষ্টেটমেণ্ট, আৰু নিয়ন্ত্ৰণ বিবৃতিৰ সৈতেও একত্ৰিত কৰিব পাৰি।)

2. Do we need to use only one type of loop in a C program? Justify your answer by Writing a C Program.

(আমি চি প্ৰ'গ্ৰাম এটাত কেৱল এক প্ৰকাৰৰ লুপ ব্যৱহাৰ কৰিব লাগিব নেকি? চি প্ৰ'গ্ৰাম এটা লিখি আপোনাৰ উত্তৰটো ন্যায়সঙ্গত কৰক।)

Ans:  No, we can use all types of loops in a C program.

(নহয়, আমি চি প্ৰ'গ্ৰাম এটাত বিভিন্ন ধৰণৰ লুপ ব্য়ৱহাৰ কৰিব পাৰো।)

3. What will happen if We Write a loop with 1 in place of the condition? try it in a Simple C Program. Hint:

(যদি আমি অৱস্থাটোৰ ঠাইত 1 ৰ সৈতে এটা লুপ লিখোঁ তেন্তে কি হ'ব? ইয়াক এটা সৰল চি প্ৰ'গ্ৰামত চেষ্টা কৰক। ইঙ্গিত:)

while (1) (আনহাতে (1))

printf ("We must raise our voice against Corruption \n");

(প্ৰিণ্টফ ("আমি দুৰ্নীতিৰ বিৰুদ্ধে মাত মাতিব লাগিব") 

Ans: Time (1) or (no non-zero value) is used for infinite loops. There are no conditions for some time. Since 1 or any non-zero has a value, the state is always true.

(অসীম লুপৰ বাবে সময় (1) বা (কোনো অ-শূন্য মান) ব্যৱহাৰ কৰা হয়। কিছু সময়ৰ বাবে কোনো চৰ্ত নাই। যিহেতু 1 বা যিকোনো অ-শূন্যৰ মূল্য আছে, ৰাজ্যসদায়ে সঁচা।)

4. Name different portions of for a loop. Can we put more than one statement within a portion?

(এটা লুপৰ বাবে ৰ বিভিন্ন অংশৰ নাম লিখা। আমি এটা অংশৰ ভিতৰত এটাতকৈ অধিক বক্তব্য ৰাখিব পাৰোনে?)

Ans: There are two parts to one for the loop: a head that specifies repetition, and a body that is performed once per repetition. The header often declares a clear loop counter or loop variable, which allows the body to know which one is being iterated.

(লুপৰ বাবে এটাৰ দুটা অংশ আছে: পুনৰাবৃত্তি নিৰ্ধাৰণ কৰা মুৰ, আৰু প্ৰতিটো পুনৰাবৃত্তিত এবাৰ কৈ কৰা শৰীৰ। হেডাৰটোৱে প্ৰায়ে এটা স্পষ্ট লুপ কাউণ্টাৰ বা লুপ ভেৰিয়েবল ঘোষণা কৰে, যি শৰীৰক কোনটো কটা হৈছে জানিবলৈ দিয়ে।)

5. Answer with TRUE of FALSE.

মিছাৰ সত্যতাৰ সৈতে উত্তৰ দিয়ক।

(i) If the condition of the while loop is false, the control comes to the second statement inside the loop.

(যদি লুপ সময়ত অৱস্থা মিছা হয়, নিয়ন্ত্ৰণটো লুপৰ ভিতৰত থকা দ্বিতীয় বিবৃতিলৈ আহে।)

Ans: If the condition is false,

This means that the code should always be implemented first and then the expression or test status will be assessed. If this is true, the body of the code loop works again. ... If the expression is false, the loop is eliminated and controls the transition to the statement after the do-well loop.

(যদি চৰ্তটো মিছা হয়,

ইয়াৰ অৰ্থ হৈছে যে কোডটো সদায়ে প্ৰথমে কাৰ্যকৰী কৰিব লাগে আৰু তাৰ পিছত অভিব্যক্তি বা পৰীক্ষাৰ স্থিতি মূল্যায়ন কৰা হ'ব। যদি এইটো সঁচা হয়, কোড লুপৰ শৰীৰে পুনৰ কাম কৰে। ... যদি অভিব্যক্তিটো মিছা হয়, লুপটো আঁতৰ কৰা হয় আৰু ডু-ৱেল লুপৰ পিছত বিবৃতিলৈ পৰিৱৰ্তন নিয়ন্ত্ৰণ কৰে।)

(ii) We can use at most three loops in a single C program.

(আমি এটা চি প্ৰ'গ্ৰামত সৰ্বাধিক তিনিটা লুপ ব্যৱহাৰ কৰিব পাৰোঁ।)

Ans: False. We can use more than three loops in a C program

(মিছা, আমি চি প্ৰ'গ্ৰামত তিনিতকৈ বেছি লুপ ব্য়ৱহাৰ কৰিব পাৰো। 

(iii) The statements inside the do-while loop executes at least once even if the condition is false.

(অৱস্থাটো মিছা হ'লেও ডু-ৱেল লুপৰ ভিতৰত থকা বিবৃতিবোৰ কমেও এবাৰ কাৰ্যকৰী হয়।)

Ans: The loop in the do-well loop is actually applied first then the situation is examined so that whether the result is applied in the first iteration is true or false, so we have concluded that the do-well loop is effective at least once despite the situation being incorrect.

(ডু-ৱেল লুপৰ লুপটো প্ৰকৃততে প্ৰথমে প্ৰয়োগ কৰা হয় তাৰ পিছত পৰিস্থিতিটো পৰীক্ষা কৰা হয় যাতে প্ৰথম পুনৰাবৃত্তিত ফলাফলপ্ৰয়োগ কৰা হয় নে মিছা হয়, সেয়েহে আমি এই সিদ্ধান্তত উপনীত হৈছো যে পৰিস্থিতিটো ভুল হোৱা স্বত্বেও ডু-ৱেল লুপ কমেও এবাৰ কাৰ্যকৰী হয়।)

(iv) Only the first statement inside the do-while loop executes when the condition is false.

(অৱস্থাটো মিছা হ'লে কেৱল ডু-ৱেল লুপৰ ভিতৰত থকা প্ৰথম বিবৃতিটোৱেই কাৰ্যকৰী কৰে।)

Ans:  True. (সঁচা)

(v) In a do-while loop, the condition is written at the end of the loop. 

এটা ডু-ৱেল লুপত, অৱস্থাটো লুপৰ শেষত লিখা হয়।

Ans: False.(মিছা)

6. Programming exercises:


A. Write a C program to find the summation of the following series

নিম্নলিখিত শৃংখলাৰ সাৰাংশ বিচাৰিবলৈ এটা চি প্ৰ'গ্ৰাম লিখক

(a). 12+22+32 + 42 + ... + N²

(b). 13+ 23 +33 +43 + ... + N³

(c). 12+23+ 34 + ... + N (N+1)

Ans:                              

B. Write a C program to continuously take a number as input and announce whether the number is odd or even. Hint: use do-while loop.

(এটা নম্বৰক নিৰন্তৰ ইনপুট হিচাপে ল'বলৈ আৰু নম্বৰটো অদ্ভূত নে সমান ঘোষণা কৰিবলৈ এটা চি প্ৰ'গ্ৰাম লিখক। ইঙ্গিত: ডু-ৱাইল লুপ ব্যৱহাৰ কৰক।)

Ans:  in the while loop construct, first the condition is checked and then the statements are executed as long as the condition is true.

C. Write a C program to display the following pattern.

তলৰ আৰ্হিটো প্ৰদৰ্শন কৰিবলৈ এটা C প্ৰগ্ৰেম লিখক।

1

11

111

1111

11111


D. Write a C program to display the following pattern.

নিম্নলিখিত আৰ্হিটো প্ৰদৰ্শন কৰিবলৈ এটা চি প্ৰ'গ্ৰাম লিখক।

5

54

543

5432

54321


E. Write a C program to display the following pattern.

নিম্নলিখিত আৰ্হিটো প্ৰদৰ্শন কৰিবলৈ এটা চি প্ৰ'গ্ৰাম লিখক।

54321

5432

543

54

5


Type & Assamese Translate : Himashree Bora.

Author-Dikha Bora

Post ID: DABP002204