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

#include <iostream>
 
int main(int argc, char const *argv[])
{
    cout<<"Hello World";
    return 0;
}

a) Hello World
b) Compile-time error
c) Run-time error
d) Segmentation fault

1 thought on “What will be the output of the following C++ code?”

  1. b
    Explanation: cout is defined under the namespace std and without including std namespace we cannot cout, therefore, the program gives an error.

Leave a Comment