My Report

C++ Programming Practice Test 10


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. Which header file is used to manipulate the vector algebra in c++?

2. How many parameters are available in srand function?

3. What will be the output of the following C++ code by manipulating the text file?

    #include <stdio.h>
    int main () 
    {
        if (remove( "myfile.txt" ) != 0 )
            perror( "Error" );
        else
            puts( "Success" );
        return 0;
    }

4. How many types of output stream classes are there in c++?

5. How many objects are used for input and output to a string?

6. Which header file is used to manipulate the string?

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

    #include <stdio.h>
    #include <math.h>
    int main ()
    {
        double param, result;
        param = 5.5;
        result = log (param);
        printf ("%lf", result );
        return 0;
    }

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

  
    #include <iostream>
    using namespace std;
    int main ()
    {
        int i;
        cout << "Please enter an integer value: ";
        cin >> i + 4;
        return 0;
    }

9. Which of the following operator is used to capture all the external variable by reference?

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

  
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    using namespace std;
    int main()
    {
        srand((unsigned)time(0));
        int ran;
        int low = 1, high = 10;
        int range = (high - low) + 1;
        for(int index = 0; index < 1; index++)
        {
            ran = low + int(range * rand() / (RAND_MAX + 1.0));
            cout << ran << endl;
        }
    }

 

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.