Using for loop c programmes

Great! Practicing for loops in C is an excellent way to strengthen your understanding of programming logic and structure. Here are 10 C programming exercises using for loops for practice, from beginner to intermediate level: --- ✅ 1. Print Numbers from 1 to N Goal: Input n and print numbers from 1 to n. int n; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     printf("%d ", i); } --- ✅ 2. Sum of First N Natural Numbers Goal: Input n, output sum 1 + 2 + ... + n. int n, sum = 0; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     sum += i; } printf("Sum = %d\n", sum); --- ✅ 3. Factorial of a Number Goal: Input n, calculate n!. int n, fact = 1; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     fact *= i; } printf("Factorial = %d\n", fact); --- ✅ 4. Multiplication Table Goal: Input n, print tabl...

Computer teacher recruitment 2020:: Very important all rounder mock test with practice

Computer related::

1. IBM introduced the first 8” floppy disk in 1971 which
could store

a. 100 KB

b. 164 KB

c. 512 KB

d. 1.44 MB

2. The storage capacity of a floppy disk is measured in

a. KB

b. MB

c. GB

d. TB

3. The storage capacity of a hard disk is measured in

a. KB

b. MB

c. GB

d. TB

4. What is the suitable output device for CAE, CAD and CAM?

a. Dot Matrix Printers

b. Laser Printers

c. Plotters

d. Projectors

5. Which of the following printer produces most noise?

a. Dot Matrix Printer

b. Inkjet Printer

c. Laser Printer

d. None of above

6. To record and produce sound in a computer system you need

a. Microphone

b. Speakers

c. Sound card

d. All of above

7. A cluster of red, green and blue diodes is driven
together to form a full-color pixel in a

a. LCD Monitor

b. LED Monitor

c. CRT Monitor

d. Monochrome Monitor

8. The temporary output of a computer system is called

a. Hardcopy output

b. Softcopy output

c. Computer Printout

d. None of above


HTML::


6.The BODY tag is usually used after

[A] HTML tag

[B] EM tag

[C] TITLE tag

[D] HEAD tag

Answer: Option [D]

7.Choose the correct HTML tag to make a text bold

[A] <bd>

[B] <bold>

[C] <bl>

[D] <b>

Ans:: D

8.Which tag adds a paragraph break after the text ?

[A] <BR>

[B] <P>

[C] <PARAGRAPH>

[D] <HR>
Ans ::- B

Math::

10. In a fixed time, a boy swims double the
distance along the current that he swims
against the current. If the speed of the
current is 3km/hr. , then what is the speed
of the boy in still water ?
A) 9 km/hr
B) 13km/hr
C) 15km/hr
D) 22km/hr
E) 10km/hr
View Answer
Option A
Solution:
Let the speed of boy in still water be x
km/hr
and the speed of current is given = 3 km/hr
Downstream speed = (x+3) km/hr
Upstream speed = (x-3) km/hr
Let time be t hours
(x+3)*t = 2 {(x-3)*t}
=> x = 9 km/hr
1. A man can row 40 kmph in still water and
the river is running at 10 kmph. If the man
takes 2 hr to row to a place and back, how
far is the place?
A) 38km
B) 37.5km
C) 40.75km
D) 41km
E) None
View Answer
Option B
Solution:
Given u=40 , v=10
D= t[(u2
-v
2
)/2u]
=2*[(402
-102
)/2*40]
=2*(1600—100)/80
2*1500/80==>37.5km
2. A man rows to a place 60 km distant and
come back in 35 hours. He finds that he can
row 4 km with the stream in the same time
as 3 km against the stream. Find the speed
in still water and in stream:
A) 1.5, 2
B) 0.5, 2.5
C) 3.5, 0.5
D) 2, 2.5
E) None
View Answer
Option C
Solution:
If he moves 4 km downstream in x hours.
Downstream speed=4/x
Upstream speed=3/x
Then 60/(4/x) + 60/(3/x)=35
60[(3x+4x)/12]=35
60*7x/12=35
5*7x=35==> x=1km.
Then Downstream speed=4km/hr ,
Upstream speed=3km/hr
U=(4+3)/2=7/2=3.5km/hr
V=(4-3)/2=1/2=0.5km/hr

3. Speed of a boat in standing water is 12
kmph and the speed of the stream is 3
kmph. A man rows to a place at a distance
of 6300 km and comes back to the starting
point. The total time taken by him is:
A) 1120hrs
B) 1000hrs
C) 980hrs
D) 850hrs
E) None
View Answer
Option A
Solution:
Downstream speed = (12 + 3) = 15 km/hr
Upstream speed = (12 – 3) = 9 km/hr
Total time taken =6300/15+6300/9
=420+700==>1120hrs.

English::

8. You surprise me.
(a) I am to be surprised
(b) You are surprised
(c) I am surprised
(d) Me is surprised

Ans : c)

9. Did you visit a zoo?
(a) Was a zoo being visited by you?
(b) Was a zoo be visited by you?
(c) Was a zoo been visited by you?
(d) Was a zoo visited by you?

Ans : d)

10. The boys were playing Cricket.
(a) Cricket had been played by the boys.
(b) Cricket has been played by the boys.
(c) Cricket was played by the boys.
(d) Cricket was being played by the boys.

Ans : d)

11. Who can question Gandhi’s integrity ?
(a) By whom Gandhi’s integrity can be questioned ?
(b) By whom can Gandhi’s integrity be questioned ?
(c) Gandhi’s integrity can be questioned by whom ?
(d) Who could have questioned Gandhi’s integrity ?

Ans : b)

12. I take exercise daily.
(a) Exercise are taken daily by me.
(b) Exercise is taken daily by me.
(c) Exercise is being taken daily by me.
(d) Exercise is been taken daily by me.

Ans : b)

13. This surface feels smooth.
(a) This surface is felt smooth.
(b) This surface is smooth when it is felt.
(c) This surface when felt is smooth.
(d) The surface is smooth as felt.

Ans : c)

14. The boy laughed at the beggar.
(a) The beggar was laughed by the boy.
(b) The beggar was being laughed by the boy.
(c) The beggar was being laughed at by the boy.
(d) The beggar was laughed at by the boy.

Ans : d)

15 Five key areas _______ identified for an integrated
action.
(A) will
(B) have been
(C) has been
(D) is

Ans . B

16 The story is that they _______ sent to the
melting-pot.
(A) was
(B) were
(C) is
(D) has been

Ans. B

G.K::

12. The head quarters of world trade 
organisation is in 

A. montreal 
B. seatle 
C. geneva 
D. the hague

Ans.C. geneva

13. The 2014 football world cup is scheduled to 
be held in 

A. China 
B. Australia 
C. Japan 
D. Brazil 

Ans. D. Brazil 

14. The Second Italian Satellite launched from 
Soviet Union was 


A. Rohini 
B. Aryabhatta 
C. Bhaskara–1 
D. Apsara 

Ans. C. Bhaskara–1 

15. The metal whose salts are sensitive to light 
is::


A. Silver 
B. Zinc 
C. Copper 
D. Gold 

Ans.A. Silver 

2. When did Mother Teresa win the Nobel 
Peace Prize? 

A. 1975 
B. 1979 
C. 1981 
D. 1982

Ans. B. 1979

3. Which one of the following glasses is used in 
bullet proof screens? 

A. Soda glass 
B. Pyrex glasss 
C. Jena glass 
D. Reinforced glass

Ans. D. Reinforced glass

4. Which substance is used to retard the 
setting action of cement? 

A. CaO 
B. AlO 
C. CaSO4,2H2O 
D. NaO + KO 

Ans. C. CaSO4,2H2O 

5. The mineral in which India depends largely 
on imports is 

A. Iron Ore 
B. Bauxite 
C. Mica 
D. Mercury

Ans. D. Mercury

6. The last Mughal Emperor was

A. Akbar 
B. Bahadur Shah 
C. NoorJehan 
D. Babur 

B. Bahadur Shah

7. The longest mountain range in the world is 

A. The Alps 
B. The Himalayas 
C. The Andes 
D. The Rockies

Ans.C. The Andes  

8. The most populous city in the world is 

A. Paris 
B. London 
C. Peking 
D. Tokyo

Ans. A. Paris 

Comments

Post a Comment

Popular posts from this blog

python in brief

advance loop based C programmes