#include<iostream> using namespace std; class quiz1 { public: int choice; void q1() { cout<<"======================= QUIZ ======================"<<endl; cout<<"======================= PART 1 ==========================="<<endl; cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<"Q1. C++ is Object Oriented Programming Language ? "<<endl; cout<<"\n 1. True \n 2. False "<<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q2. How do You Insert COMMENTS in c++ Code ? "<<endl; cout<<"\n 1. # This Is Comment \n 2. /* This is a Comment \n 3. // This is a Comment \n 4.//** This \is Comment " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> CORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q3. Which Data Type is Used to create Variable that should Store Text ? "<<endl; cout<<"\n 1. string \n 2. Txt \n 3. String \n 4. myString " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q4. How to Create a vaiable with numeric value 5 ? "<<endl; cout<<"\n 1. int x = 5; \n 2. double x = 5; \n 3. x=5; \n 4. num x = 5; " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q5. Which method can be used to find the length of a string ? "<<endl; cout<<"\n 1. len() \n 2. getSize() \n 3. length \n 4. getLength() " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> CORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } } }; class quiz2 : public quiz1 { public : int choice; void q2() { //cout<<"======================= QUIZ ======================"<<endl; cout<<"======================= PART 2 ==========================="<<endl; cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q6. Which operator is used to ADD together two Values ? "<<endl; cout<<"\n 1. + \n 2. * \n 3. / \n 4. - " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<endl; //cout<<":::::::::::::::::Select One Option ::::::::::::::::::::::::"<<endl; cout<<endl; cout<<"Q7. The Value of String variable can be Surrounded by single Quotes ? "<<endl; cout<<"\n 1. True \n 2. False " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> CORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q8. Which header file lets us Work With input and output objects ? "<<endl; cout<<"\n 1. #include<iostream> \n 2. #include<stream> \n 3. #include<inputstr> \n 4. #include<iosstring>" <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q9. Which operator is used to Compare Two Values ? "<<endl; cout<<"\n 1. == \n 2. = \n 3. >< \n 4. <> " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q 10. To Declare an Array in C++ , Define the Vaariable Type with :: ? "<<endl; cout<<"\n 1. () \n 2. [] \n 3. <> \n 4. {} " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> CORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } } }; class quiz3 : public quiz2 { public: int choice; void q3() { cout<<"======================= PART 3 ==========================="<<endl; cout<<endl; cout<<"Q 11. Array indexes Start With ? "<<endl; cout<<"\n 1. 1 \n 2. 0 " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> CORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q 12. How do we Create a function in C++ ? "<<endl; cout<<"\n 1. functionName() \n 2. functionName[] \n 3. functionName. \n 4. (functionName) " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> CORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q 13. How do you Call a Function in C++ "<<endl; cout<<"\n 1. functionName[]; \n 2. functionName(); \n 3. functionName; \n 4. (functionName); " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> CORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q 14. Which keyword is used to create a class in C++ ? "<<endl; cout<<"\n 1. Myclass \n 2. className \n 3. class \n 4. class() " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> CORRECT "<<endl; break; case 4: cout<<"-> INCORRECT "<<endl; break; default: cout<<"Invalid Choice "; } cout<<endl; cout<<"Q 15. What is correct way to Create an Object Called myObj of Class ? "<<endl; cout<<"\n 1. new myObj = Myclass(); \n 2. class Myclass = new myObj(); \n 3. class myObj = new MyClass(); \n 4. Myclass myObj; " <<endl; cin>>choice; switch(choice) { case 1: cout<<"-> INCORRECT "<<endl; break; case 2: cout<<"-> INCORRECT "<<endl; break; case 3: cout<<"-> INCORRECT "<<endl; break; case 4: cout<<"-> CORRECT "<<endl; break; default: cout<<"Invalid Choice "; } } }; class display : public quiz3 { public: int choice; void disp() { cout<<"Q1 -> 1. True "<<endl; cout<<"Q2 -> 3. // This is a Comment "<<endl; cout<<"Q3 -> 1. string "<<endl; cout<<"Q4 -> 1. int x = 5; "<<endl; cout<<"Q5 -> 3. length "<<endl; cout<<"Q6 -> 1. + "<<endl; cout<<"Q7 -> 1. False "<<endl; cout<<"Q8 -> 1. #include<iostream> "<<endl; cout<<"Q9 -> 1. == "<<endl; cout<<"Q10 -> 2. [] "<<endl; cout<<"Q11 -> 2. 0 "<<endl; cout<<"Q12 -> 1. functionName() "<<endl; cout<<"Q13 -> 2. functionName(); "<<endl; cout<<"Q14 -> 3. class "<<endl; cout<<"Q15 -> 4. Myclass myObj; "<<endl; } void disp1() { cout<<"Do you Want to Correct Answers ?????????? \n 1).Yes \n 2) No "<<endl; cin>>choice; switch(choice) { case 1: disp(); break; case 2: cout<<" ==============================THANK YOU ========================================="; break; default: cout<<"INVALID"<<endl; } } }; int main() { display d; d.q1(); d.q2(); d.q3(); d.disp1(); /* q.q4(); q.q5(); q.q6(); q.q7();*/ return 0; }