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(“\n\nWELCOME TO THE MULTIPLE CHOICE QUESTIONS : “);
printf(“\n\n\nPLEASE 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(“\n\n\n 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(“\n\n\n\t\tINDIRA GANDHI NATIONAL OPEN UNIVERSITY”);
printf(“\n\t\t\t(MCQ – 2015)”);
printf(“\n\t_______________________________________________________________”);
printf(“\n\n\tQ_NO. %d. %s”,MCQ[Qno].NO,MCQ[Qno].QTN);
printf(“\n\t_______________________________________________________________”);
printf(“\n\n\t1.\t%s\t\t2.\t%s\t”,MCQ[Qno].CH1,MCQ[Qno].CH2);
printf(“\n\n\t3.\t%s\t\t4.\t%s\t”,MCQ[Qno].CH3,MCQ[Qno].CH4);
printf(“\n\t_______________________________________________________________”);
printf(“\n\tENTER 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(“\n\nWELCOME TO THE MULTIPLE CHOICE QUESTIONS : “);
printf(“\n\n\nPLEASE 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(“\n\n\n 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(“\n\n\n\t\tINDIRA GANDHI NATIONAL OPEN UNIVERSITY”);
printf(“\n\t\t\t(MCQ – 2015)”);
printf(“\n\t_______________________________________________________________”);
printf(“\n\n\tQ_NO. %d. %s”,MCQ[Qno].NO,MCQ[Qno].QTN);
printf(“\n\t_______________________________________________________________”);
printf(“\n\n\t1.\t%s\t\t2.\t%s\t”,MCQ[Qno].CH1,MCQ[Qno].CH2);
printf(“\n\n\t3.\t%s\t\t4.\t%s\t”,MCQ[Qno].CH3,MCQ[Qno].CH4);
printf(“\n\t_______________________________________________________________”);
printf(“\n\tENTER 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("\n\nWELCOME TO THE MULTIPLE CHOICE QUESTIONS : ");
printf("\n\n\nPLEASE 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("\n\n\n 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("\n\n\n\t\tINDIRA GANDHI NATIONAL OPEN UNIVERSITY");
printf("\n\t\t\t(MCQ - 2015)");
printf("\n\t_______________________________________________________________");
printf("\n\n\tQ_NO. %d. %s",MCQ[Qno].NO,MCQ[Qno].QTN);
printf("\n\t_______________________________________________________________");
printf("\n\n\t1.\t%s\t\t2.\t%s\t",MCQ[Qno].CH1,MCQ[Qno].CH2);
printf("\n\n\t3.\t%s\t\t4.\t%s\t",MCQ[Qno].CH3,MCQ[Qno].CH4);
printf("\n\t_______________________________________________________________");
printf("\n\tENTER UR ANSWER (IN NUMBER) :");
scanf("%d",&N);
if(N==MCQ[Qno].AnsNo) MARKS[Qno]=1; else MARKS[Qno]=0;
}
0 टिप्पणियाँ:
Post a Comment