You are on page 1of 71

Kendriya Vidyalaya

Sector-2 R K Puram

Name : Atulya Verma


Class : 11th F
Roll no: 30
Computer science Project

Science Quiz
Guided by:
M/s Swati Saxena

Done by:-
Atulya Verma

CONTENT
1. Certificate
2. Acknowledgement
3. Requirements
4. Header Files and Purpose
5. General Description
6. Functions & Their Purpose
7. Flow Chart
8. Source code
9. Output
10. Limitations
11. Bibliography
This is certifying that “Atulya verma”
of class XI has successfully completed his
“Computer science practical Report file”.
During academic session 2017-2018 as
per the guidelines issued by CBSE.

Teacher’s Signature Examiner’s


signature

________________ __________________

DATE PRINCIPAL

________________ __________________

Acknowledgement
I wish to express my sincere thanks to
Mr.Awadhesh dubey Principal, Kendriya
Vidyalaya R K puram sector-2, New Delhi for
guiding us to cause the successful outcome of
this project work.
I wish to express my deep & profound sense of
gratitude to our guide teacher M/S Swati
Saxena(COMP), For her expert help &
valuable guidance, comments and suggestions.

I also place on record, our sincere Gratitude to


one and all who directly or indirectly .Have
Lent their helping hand in this venture

Requirements
Hardware
❖Printer to print the project
report.
❖Compact Disc.
❖Ram 2 GB
❖Hard Disk 512 Gb
Software
❖Operating System Windows
10
❖Turbo C++ for Execution of
Program.
❖ MS Word for Report
Presentation.
Header files and their
purpose
1.iostream.h - used to access the input
output built in functions of the language
as it is the “Standard input/output
streams library”.
2.conio.h - used by to provide console
input/output.
3.ctype.h-Declares a set of functions to
classify and transform individual
characters.
4.Stdlib.h- Includes functions involving
memory allocation, process control,
conversions and others.

General Description
Quiz program

This program contains 20 multiple choice


questions ,where you have four options in
every questions a, b , c & d .
From the four options, only one option is
correct.
On each correct answer you will be
rewarded with 5 points and if your answer
is wrong, you don’t get any points.
Out of 20, each 5 questions are from
Chemistry, physics, mathematics and
biology.

System Defined Functions &


Their Uses
1.Clrscr():Used to clear the console screen.
2.getch():Used to hold program execution
3.getche():Used to get a single character
from user.

4.exit():Used to terminate the program.

User Defined Functions &


Their Purpose
1).This function is used for displaying score
when user decides to quits the quiz.
void displaydata(int x)
{
clrscr();
for(int i=0;i<80;i++)
cout<<"~";
cout<<"Your Score is"<<x<<"\n\n";
for(i=0;i<80;i++)
cout<<"~";
getch();
}

Flowchart
Displaydata function
Source code
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<stdlib.h>
void displaydata(int x=0);
void main()
{
clrscr();
int x=0;
char name[100],ch;
cout<<"\n\t\tHello\nWelcome to land of quizes ";
cout<<"\nWhat is your name : ";
cin>>name;
name[0]=toupper(name[0]);
clrscr();
for(int i=0;i<80;i++)
cout<<"~";
cout<<"This quiz contains 20 Questions,each question is
of 4 marks.\nThere is no negative marking\nYou Can exit
Quiz at any time by prssing n ";
cout<<"\nEnter Answer in form of 'a','b','c' and 'd'only \n";
for(i=0;i<80;i++)
cout<<"~";
getch();
do
{
clrscr();
cout<<"\n\n\n1.What do you call an atom that has more
proton than electrons?"<<"\n\t(a)Molecule\t\t\t(b)Cation\n\
t(c)Anion\t\t\t(d)Isotope";
cout<<"\nAns:";
ch=getche();
if(ch=='b')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='c'||ch=='d')
{
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
}
else
{
cout<<"\nInvalid answer";
}
}
while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n2.Acid present in Lemon is "<<" ? "<<"\n\
t(a)Oxalic acid\t\t\t(b)Gluconic acid\n\t(c)Tartaric acid\t\
t(d)Citric Acid";
cout<<"\nAns:";
ch=getche();
if(ch=='d')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='c')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n3.Which were the first elements to be form
after big bang started to cool ?"<<"\n\t(a)Uranium and
Plutonium\t\t(b)Carbon and Silicon\n\t(c)Hydrogen and
Helium\t\t\t(d)Oxygen and Nitrogen";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n4.Alcohols are isomeric with which following
structures? "<<"\n\t(a)Ether\t\t\t(b)Acids\n\t(c)Ester\t\t\
t(d)Aldehydes";
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='b'||ch=='c'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n5.Which of the following is a faveroble
conditions for cation formation ? "<<"\n\t(a)Low ionisation
potential\t\t\t(b)Low electron affinity\t(c)High
electronegativity\t\t\t(d)Small atomic size";
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='b'||ch=='c'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
getch();
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
do
{
clrscr();
cout<<"\n\n\n6.The time required for one complete
revolution or cycle of the circular motion is called? "<<"\n\
t(a)Angular time\t\t\t(b)Time Duration\n\t(c)Time Period\t\
t\t(d)Time piece";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n7.The oldest type of Energy known to man
is ?"<<"\n\t(a)Wind power\t\t\t(b)Solar power\n\t(c)Tidal
energy\t\t\t(d)Geothermal energy";
cout<<"\nAns:";
ch=getche();
if(ch=='b')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='c'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n8.Centigrade & Fahrenheit scales give
same reading at "<<"\n\t(a)-32 c\t\t\t(b)-40 c\n\t(c)-273 c\t\
t\t(d)100 c";
cout<<"\nAns:";
ch=getche();
if(ch=='b')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n9.A body starts from rest.If it travels with an
acceleration of 2m/s2,its displacement at the end of 3
seconds is"<<"\n\n \n\t(a)9 m\t\t\t(b)12 m\n\t(c)18 m\t\t\
t(d)3 m";\
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='c'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n10.Which of the following instruments is
used to measure pressure of gases? "<<"\n\n \n\
t(a)Barometer\t\t\t(b)Manometer\n\t(c)Ammeter\t\t\
t(d)None of these";
cout<<"\nAns:";
ch=getche();
if(ch=='b')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='d'||ch=='c')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n11.If '+' means 'x', '-' means '+', 'x' means '/'
and '/' means '-' then find the value of 6 - 9 + 8 x 3 / 20 =
__. "<<"\n\n \n\t(a)6\t\t\t(b)12\n\t(c)-2\t\t\t(d)10";
cout<<"\nAns:";
ch=getche();
if(ch=='d')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='c')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n12.In the following series a wrong number is
given. Find out that number.4, 5, 10, 18, 34, 59, 95"<<"\n\
n \n\t(a)10\t\t\t(b)5\n\t(c)18\t\t\t(d)34";
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='c'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n13.Which of following is divisble by 2,3, 4,
and 5 ?"<<"\n\n \n\t(a)234560\t\t\t(b)123570\n\
t(c)1234560\t\t\t(d)1234550";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n14.What is average of all positive integers
less than 100 and multiples of 7?"<<"\n\n\n\t(a)52\t\t\
t(b)52.5\n\t(c)50.5\t\t\t(d)50";
cout<<"\nAns:";
ch=getche();
if(ch=='b')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='d'||ch=='c')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n15.The average of tweleve number is 8 and
average of eight numbers is 12.What is average of all
these numbers ?"<<"\n\n \n\t(a)10.1\t\t\t(b)9.9\n\t(c)9.6\t\
t\t(d)10.4";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n16.Carbohydrates are made of "<<"\n\n \n\
t(a)Amino acids\t\t\t(b)Fatty acids\n\t(c)Nucleotides\t\t\
t(d)Sugars";
cout<<"\nAns:";
ch=getche();
if(ch=='d')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='c')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n17.Proteins are made of "<<"\n\n \n\
t(a)Amino acids\t\t\t(b)Fatty acids\n\t(c)Nucleotides\t\t\
t(d)Sugars";
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='c'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n18.The disease kala azar is caused by a
micro organism known as"<<"\n\n \n\t(a)Planaria\t\t\
t(b)Leech\n\t(c)Leishmania\t\t\t(d)Plasmodium";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n19.What is cancer ?"<<"\n\n\n\t(a)Cell
Divison gone wrong\t\t(b)Over growth in cells\n\t(c)All of
the above\t\t\t(d)None of the above";
cout<<"\nAns:";
ch=getche();
if(ch=='a')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='c'||ch=='b'||ch=='d')
{
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
}
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
do
{
clrscr();
cout<<"\n\n\n20.The number of chromosomes in human
body is"<<"\n\n \n\t(a)23\t\t\t(b)48\n\t(c)46\t\t\t(d)24";
cout<<"\nAns:";
ch=getche();
if(ch=='c')
{
x+=5;
cout<<"\nCongratulations, Your Answer is right,
"<<"\""<<name<<"\".";
}
else if(ch=='n')
{
displaydata(x);
exit(0);
getch();
}
else if(ch=='a'||ch=='b'||ch=='d')
cout<<"\n"<<"\""<<name<<"\""<<"Your answer is
wrong.";
else
{
cout<<"\nInvalid answer";
}
}while(ch!='a' && ch!='b' && ch!='c' && ch!='d' && ch!='n');
getch();
clrscr();
for(i=0;i<80;i++)
cout<<"~";
cout<<"Your Score is"<<x<<"\n\n";
for(i=0;i<80;i++)
cout<<"~";
getch();
}
void displaydata(int x)
{
clrscr();
for(int i=0;i<80;i++)
cout<<"~";
cout<<"Your Score is"<<x<<"\n\n";
for(i=0;i<80;i++)
cout<<"~";
getch();
}

Output
Limitations
1. Limited number of questions.
2. Questions of limited subjects.
3. Cannot store scores of users.

Bibliography
1.Computer science with c++- Sumita
arora
2. www.geeksforgeeks.org/c-plus-plus/

You might also like