Basic Syntax


  1. What is the use of the function “showbase”?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Indicate the base used


  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
    unsigned long num = 56;
    cout << num << oct <<" " << num << endl;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In this program, We are finding the octal number of given number by using oct function.



  1. What is the output of this program?
     #include <iostream>
    #include <iomanip>
    using namespace std;
    void showDate(int mm, int dd, int yy)
    {
    cout << setfill('0');
    cout << setw(2) << mm << '/'
    << setw(2) << dd << '/'
    << setw(4) << yy << endl;
    }
    int main()
    {
    showDate(1, 1, 2019);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In this program, We are using the setw function to print the date in correct format.


  1. Which function allows you to set minimum width for the next input?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    setw function of iomanip header file allows you to set minimum width for the next input.



  1. Choose the correct formatted code.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The braces that tell where a function begins and ends should be aligned with the function name and be on their own lines.