Quiz on Tokens and Keywords in C++
A token is a nimble element that can be interpreted by a compiler as part of a C++ program. C++ recognizes the following token types: keywords, identifiers, numeric, Boolean, and pointers. Now, let’s try to understand Tokens and Keywords of C++ in detail with a quick quiz. Enjoy your learning experience.
0 of 15 Questions completed Questions: You have already completed the quiz before. Hence you can not start it again. Quiz is loading… You must sign in or sign up to start the quiz. You must first complete the following: 0 of 15 Questions answered correctly Your time: Time has elapsed You have reached 0 of 0 point(s), (0) Earned Point(s): 0 of 0, (0) Types of tokens in C++ are: How many additional keywords are there in C++ other than C: *(asterisk) operator symbol is used to create: #include <iostream> using namespace std; int main() { int x=5, y=15; register int z; z=x+y; cout<<z; return 0; } #include <iostream> using namespace std; int main() { int x=5, y=15; const int z=x*y; cout<<z; return 0; } #include <iostream> using namespace std; static int z=10; int fun(int a) { return a++; } int main() { int x=5, y=15; fun(z); z=z+x*y; fun(z); z=z+x*y; fun(z); cout<<z; return 0; } #include <iostream> using namespace std; static int z=10; int fun(int a,int b) { if(a<b) { z++; cout<<z; goto updated; ++z; cout<<z; goto updated; z+=++z; cout<<z; return 1; } updated: return 0; } int main() { int x=5, y=15; fun(x,y); return 0; } #include <iostream> using namespace std; static int z=10; int fun(int a,int b) { for(z=0;z<a;z++) { if(a<b) { z++; cout<<z; break; } else if(a>=b) { ++z; cout<<z; continue; } } } int main() { int x=5, y=15; fun(x,y); return 0; } #include <iostream> using namespace std; static int z=10; int fun(int a,int b) { for(int i=0;i<a;i++) { if(a<b ||a<z) { z++; continue; } else if(a>=b ||a>z) { ++z; break; } } cout<<z; } int main() { int x=5, y=15; fun(x,y); return 0; } #include <iostream> using namespace std; static int z=10; int fun(int a,int b) { for(int i=0;i<a;i++) { if(a<b ||a<z) { z++; continue; } else if(a>=b ||a>z) { ++z; break; } } cout<<sizeof(z)+sizeof(a)+sizeof(b); } int main() { int x=5, y=15; fun(x,y); return 0; } #include <iostream> using namespace std; class Student{ public: int rollno=10; static int courseid; }; int Student::courseid = 115; int main() { Student s1; s1.rollno=15; cout<<s1.rollno<<” “<<s1.courseid; return 0; } #include <iostream> using namespace std; class Student{ public: const int rollno=10; static int courseid; }; int Student::courseid = 115; int main() { Student s1; s1.rollno=15; cout<<s1.rollno<<“QuizOrbit “<<s1.courseid; return 0; } Which of the following is a keyword in C++? #include <iostream> using namespace std; int main() { int a,b,c; a=10; b=20; c=a<b?15:25; cout<<c; return 0; } #include <iostream> using namespace std; int main() { int n0 = 4; switch (n0) { case 1: cout << “Subject1”; break; case 2: cout << “Subject2” << endl; break; case 3: cout << “Subject3” << endl; break; case 4: cout << “Subject4″<< endl; case 5: cout << “Subject5″<< endl; default: cout << “Enter Valid number”<< endl; } return 0; } Quiz Summary
Information
Results
Results
0 Essay(s) Pending (Possible Point(s): 0) Categories
1. Question
2. Question
3. Question
4. Question
5. Question
6. Question
7. Question
8. Question
9. Question
10. Question
11. Question
12. Question
13. Question
14. Question
15. Question
Summary
The reason why tokens are called building blocks in C++ now is clear. A token consists of keyword, identifier, constant, string, special symbol, and operations, and are all equally important in C++ programming. Hopefully, with the quick quiz all your doubts are being resolved. If you still have any doubt then it is recommended to go to a tutorial and understand each concept in detail. Have a good learning experience!