My Report

C++ Data Types Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What will be the output of the following C++ code?

    #include <stdio.h>
    int main()
    {
        char a = '\012';

        printf("%d", a);
        return 0;
    }
    

2. How do we represent a wide character of the form wchar_t?

3. In C++, what is the sign of character data type by default?

4. What constant defined in <climits> header returns the number of bits in a char?

5. Is the size of character literals different in C and C++?

6. Which of the following belongs to the set of character types?

7. Given the variables p, q are of char type and r, s, t are of int type. Select the right statement?

    1. t = (r * s) / (r + s);
    2. t = (p * q) / (r + s);

8. Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?

9. How many characters are specified in the ASCII scheme?

10. What will be the output of the following C++ code?

    #include <iostream>
    using namespace std;
    int main()
    {
        char c = 74;
        cout << c;
        return 0;
    }
    

 

Start practicing “1000 MCQs on C++”, and once you are ready, you can take tests on all topics by attempting our “C++ Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.