Data Types
- Pick the right option
Statement (i) A definition is also a declaration.
Statement (ii) An identifier can be declared just once.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
An identifier can be declared many times must be defined just once.
- Which of the given statements are false.
(i). extern int func;
(ii). extern int func2(int,int);
(iii). int func2(int,int);
(iv). extern class foo;
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
No extern are allowed for class declarations.
- Pick the right option
Statement (i) Global values are not initialized by the stream.
Statement (ii) Local values are implicitly initialised to 0.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Global values are implicitly initialised to 0, but local values have to be initialised by the system.
- Can two functions declare variables(non static) with the same name.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
We can declare variables with the same name in two functions because their scope lies within the function.
- What is the output of this program?
#include
using namespace std;
void Output()
{
static int p = 1;
int k;
for(k=p; k<=3; k++)
{
p++;
cout << p;
}
}
int main()
{
Output();
Output();
Output();
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The variable that is declared as static has a file scope.