C Source Code for Online Examination

Only available on StudyMode
  • Download(s) : 1337
  • Published : April 6, 2012
Open Document
Text Preview
SOURCE CODE
#include
#include
#include
#include
#include

main()
{
int score=0;
char ch,temp,login[100],*pass;
textcolor(0);
textbackground(15);
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\tWELCOME TO 'YUUVVA'ONLINE EXAMINATION\n\n\t\tPRESS ENTER TO CONTINUE\n\n\t\t"); temp=getchar();
clrscr();
printf("\n\n\n\n\n\n\n\n\n\t\t\tENTER YOUR LOGIN\n\n\t\t\t"); scanf("%s",login);
printf("\n\n\n\n\t\t\tENTER PASSWORD\n\n\t\t\t");
pass=getpass(" ");
while(strcmp(login,pass)!=0)
{
printf("\n\n\t\t\tINVALID PASSWORD\n\n\t\t\t");
printf("\n\n\t\t\tENTER YOUR PASSWORD\n\n\t\t\t");
pass=getpass(" ");
}
temp=getchar();
clrscr();

printf("\n\n\t\tREAD THE FOLLOWING RULES CAREFULLY\n\n\n1.THE EXAMINATION IS FOR 3 SUBJECTS: PHYSICS, CHEMISTRY, MATHEMATICS\n\n2.EACH SUBJECT HAS 10 QUESTIONS EACH\n\n3.THE QUESTIONS ARE OF MULTIPLE CHOICE TYPE WITH 4 OPTIONS A, B, C, D OUT OF WHICH ONLY ONE IS APPROPRIATE\n\n4.+4 MARKS FOR EVERY CORRECT ANSWER AND A PENALTY OF -1 MARKS WILL BE AWARDED FOR EACH WRONG ANSWER\n\n5.YOU ARE ALLOWED TO QUIT ANYTIME IN BETWEEN BY PRESSING 'Q' ON THE KEYBOARD WHEREIN YOUR FINAL SCORE OUT OF 120 WILL BE DISPLAYED\n\n\n\n\n\n\n\n\t\t\tALL THE BEST!!!\n\n");

temp=getchar();
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t\t\t\tPHYSICS\n");
temp=getchar();
if(!kbhit())
clrscr();
printf("\n\n\n\n1.An electric dipole is placed at an angle of 30 deg to a non uniform electric field. The dipole will experience \n\nA. a torque as well as a translational force \n\nB. torque only \n\nC. translational force only in the direction of the field \n\nD. translational force only in the direction normal to the direction of field\n\n"); scanf("%c",&ch);

ch=toupper(ch);

temp=getchar();
if(ch=='Q')
{
clrscr();
printf("\t\tYOUR FINAL SCORE\n\n\n\t\t%d",score);
exit(1);
}

else
{
if(ch=='A')
score+=4;
else
score-=1;
}
clrscr();
printf("\n\n\n\n2.A particle located at x=0 at time y=0,starts moving along the positive x\ndirection with a velocity 'v' that varies as v=a times root x where a is a\nconstant.\nThe displacement of the particle varies with time as\n\nA. t^1/2\n \nB. t^2\n\nC. t^3\n\nD. t\n\n"); scanf("%c",&ch);

temp=getchar();
ch=toupper(ch);
if(ch=='Q')
{
clrscr();
printf("\t\tYOUR FINAL SCORE\n\n\n\t\t%d",score);
exit(1);
}
else
{
if(ch=='C')
score+=4;
else
score-=1;
}
clrscr();
printf("\n\n\n\n3.In a region,steady and uniform electric and magnetic fields are present.These two fields are parallel to each other. A charged particle is released from rest in this region. The path of the particle will be \n\nA.an ellipse\n\nB.a circle\n\nC.a helix\n\nD.a straight line\n\n"); scanf("%c",&ch);

temp=getchar();
ch=toupper(ch);
if(ch=='Q')
{
clrscr();
printf("\t\tYOUR FINAL SCORE\n\n\n\t\t%d",score);
exit(1);
}
else
{
if(ch=='D')
score+=4;
else
score-=1;
}
clrscr();
printf("\n\n\n\n4.Needles N1, N2, N3 are made of ferromagnetic,paramagnetic and a diamagnetic substance respectively. A magnet when brought close to them will \n\nA. attract N1 strongly but repel N2 and N3 weakly\n\nB. attract all three of them\n\nC. attract N1 and N2 strongly but repel N3\n\nD. attract N1 strongly and N2 weakly and repel N3 weakly\n\n"); scanf("%c",&ch);

temp=getchar();
ch=toupper(ch);
if(ch=='Q')
{
clrscr();
printf("\t\tYOUR FINAL SCORE\n\n\n\t\t%d",score);
exit(1);
}

else
{
if(ch=='D')
score+=4;
else
score-=1;
}
clrscr();
printf("\n\n\n\n5.A bomb of mass 16kg at rest explodes into two pieces of masses 4kg and 12kg. The velocity of 12kg mass is 4m/s. The kinetic energy of the other mass is\n\nA. 192 J\n\nB. 96 J\n\nC. 144 J\n\nD. 288 J\n\n"); scanf("%c",&ch);

temp=getchar();
ch=toupper(ch);
if(ch=='Q')
{
clrscr();
printf("\t\tYOUR FINAL SCORE\n\n\n\t\t%d",score);
exit(1);
}
else
{
if(ch=='D')
score+=4;...
tracking img