Q1. Define a flowchart. Write an algorithm and draw a corresponding flowchart to create a simple multiple choice question (MCQ) examination of 25 questions for 50 marks along with evaluation process too.
Q2. Compare and contrast the characteristics and/or organisation of the Write an interactive C program for Q1. marks along with evaluation process too.
#include<stdio.h>
int MARKS[5];
struct MCQ
{
int NO;
char QTN[100],CH1[25],CH2[25],CH3[25],CH4[25];
int AnsNo;
}MCQ[5]={
{1,”sizeof is an example of _____.”,”Binary Optr”,”Unary Optr”,”Ternary Optr”,”None of these”,3},
{2,”Associativity of Unary Operator is from __to__.”,”Left to Right”,”Right to Left”,”Both”,”None of these”,2},
{3,”Which of the following Operator has lowest precedence amongst all the Operators?”,”Logical AND”,”Modulus”,”Comma”,”Plus”,3},
{4,”Unary Operators are Operators having ____.”,”Highest Precedence”,”Lowest Precedence”,”Both”,”None of these”,1},
{5,”Which is the Correct Hierarchy of Arith Optrs in C ?”,”/*+-”,”*-/+”,”/+*-”,”+-/*”,1}, };
void main()
{
char C;
int I,T=0;
void gen_mcq();
clrscr();
printf(“nnWELCOME TO THE MULTIPLE CHOICE QUESTIONS : “);
printf(“nnnPLEASE ENTER Y OR y TO CONTINUE:”);
scanf(“%c”,&C);
if(C==’Y’||C==’y’)
{
for(I=0;I<5;I++)
gen_mcq(I);
for(I=0;I<5;I++)
T=T+MARKS[I];
printf(“nnn YOU GOT %d CORRECT OUT OF 5 IN YOUR MCQ.”,T);
}
else
printf(“nWE ARE QUITING MCQ!!”);
getch();
}
void gen_mcq(int Qno)
{
int N;
clrscr();
printf(“nnnttINDIRA GANDHI NATIONAL OPEN UNIVERSITY”);
printf(“nttt(MCQ – 2015)”);
printf(“nt_______________________________________________________________”);
printf(“nntQ_NO. %d. %s”,MCQ[Qno].NO,MCQ[Qno].QTN);
printf(“nt_______________________________________________________________”);
printf(“nnt1.t%stt2.t%st”,MCQ[Qno].CH1,MCQ[Qno].CH2);
printf(“nnt3.t%stt4.t%st”,MCQ[Qno].CH3,MCQ[Qno].CH4);
printf(“nt_______________________________________________________________”);
printf(“ntENTER UR ANSWER (IN NUMBER) :”);
scanf(“%d”,&N);
if(N==MCQ[Qno].AnsNo) MARKS[Qno]=1; else MARKS[Qno]=0;
}
int MARKS[5];
struct MCQ
{
int NO;
char QTN[100],CH1[25],CH2[25],CH3[25],CH4[25];
int AnsNo;
}MCQ[5]={
{1,”sizeof is an example of _____.”,”Binary Optr”,”Unary Optr”,”Ternary Optr”,”None of these”,3},
{2,”Associativity of Unary Operator is from __to__.”,”Left to Right”,”Right to Left”,”Both”,”None of these”,2},
{3,”Which of the following Operator has lowest precedence amongst all the Operators?”,”Logical AND”,”Modulus”,”Comma”,”Plus”,3},
{4,”Unary Operators are Operators having ____.”,”Highest Precedence”,”Lowest Precedence”,”Both”,”None of these”,1},
{5,”Which is the Correct Hierarchy of Arith Optrs in C ?”,”/*+-”,”*-/+”,”/+*-”,”+-/*”,1}, };
void main()
{
char C;
int I,T=0;
void gen_mcq();
clrscr();
printf(“nnWELCOME TO THE MULTIPLE CHOICE QUESTIONS : “);
printf(“nnnPLEASE ENTER Y OR y TO CONTINUE:”);
scanf(“%c”,&C);
if(C==’Y’||C==’y’)
{
for(I=0;I<5;I++)
gen_mcq(I);
for(I=0;I<5;I++)
T=T+MARKS[I];
printf(“nnn YOU GOT %d CORRECT OUT OF 5 IN YOUR MCQ.”,T);
}
else
printf(“nWE ARE QUITING MCQ!!”);
getch();
}
void gen_mcq(int Qno)
{
int N;
clrscr();
printf(“nnnttINDIRA GANDHI NATIONAL OPEN UNIVERSITY”);
printf(“nttt(MCQ – 2015)”);
printf(“nt_______________________________________________________________”);
printf(“nntQ_NO. %d. %s”,MCQ[Qno].NO,MCQ[Qno].QTN);
printf(“nt_______________________________________________________________”);
printf(“nnt1.t%stt2.t%st”,MCQ[Qno].CH1,MCQ[Qno].CH2);
printf(“nnt3.t%stt4.t%st”,MCQ[Qno].CH3,MCQ[Qno].CH4);
printf(“nt_______________________________________________________________”);
printf(“ntENTER UR ANSWER (IN NUMBER) :”);
scanf(“%d”,&N);
if(N==MCQ[Qno].AnsNo) MARKS[Qno]=1; else MARKS[Qno]=0;
}
Code
c#include<stdio.h> int MARKS[5]; struct MCQ { int NO; char QTN[100],CH1[25],CH2[25],CH3[25],CH4[25]; int AnsNo; }MCQ[5]={ {1,"sizeof is an example of _____.","Binary Optr","Unary Optr","Ternary Optr","None of these",3}, {2,"Associativity of Unary Operator is from __to__.","Left to Right","Right to Left","Both","None of these",2}, {3,"Which of the following Operator has lowest precedence amongst all the Operators?","Logical AND","Modulus","Comma","Plus",3}, {4,"Unary Operators are Operators having ____.","Highest Precedence","Lowest Precedence","Both","None of these",1}, {5,"Which is the Correct Hierarchy of Arith Optrs in C ?","/*+-","*-/+","/+*-","+-/*",1}, }; void main() { char C; int I,T=0; void gen_mcq(); clrscr(); printf("nnWELCOME TO THE MULTIPLE CHOICE QUESTIONS : "); printf("nnnPLEASE ENTER Y OR y TO CONTINUE:"); scanf("%c",&C); if(C=='Y'||C=='y') { for(I=0;I<5;I++) gen_mcq(I); for(I=0;I<5;I++) T=T+MARKS[I]; printf("nnn YOU GOT %d CORRECT OUT OF 5 IN YOUR MCQ.",T); } else printf("nWE ARE QUITING MCQ!!"); getch(); } void gen_mcq(int Qno) { int N; clrscr(); printf("nnnttINDIRA GANDHI NATIONAL OPEN UNIVERSITY"); printf("nttt(MCQ - 2015)"); printf("nt_______________________________________________________________"); printf("nntQ_NO. %d. %s",MCQ[Qno].NO,MCQ[Qno].QTN); printf("nt_______________________________________________________________"); printf("nnt1.t%stt2.t%st",MCQ[Qno].CH1,MCQ[Qno].CH2); printf("nnt3.t%stt4.t%st",MCQ[Qno].CH3,MCQ[Qno].CH4); printf("nt_______________________________________________________________"); printf("ntENTER UR ANSWER (IN NUMBER) :"); scanf("%d",&N); if(N==MCQ[Qno].AnsNo) MARKS[Qno]=1; else MARKS[Qno]=0; }