Hi! I have a few short questions about C++ Thank you! 1. Given the statement: in
ID: 666222 • Letter: H
Question
Hi! I have a few short questions about C++ Thank you!
1.Given the statement: int list[25]; The index can go from 0 to 25 inclusive without going beyond the end of the array.true or false?
2. The main purpose of a constructor is to initialize the data members at the moment that an object is created. true or false?
3.Given the declaration: int list[50] ; the statement: cout<<list<<endl; outputs all 50 components of the array list on one line. true or false?
4. Given the function prototype: int testBeta(int x, char v, int y); the following statement in the main program is legal.
cout<<testBeta(5, char 'A', int 2); true or false?
5. Suppose x = 10 and y = 20. The value of the expression
((x >= 10) && (y > 20) || (x < y) ) true or false?
THANK YOU!
Explanation / Answer
1. true
2. True
A class constructor is a special member function of a class that is executed whenever we create new objects of that class
3. false
#include<stdio.h>
#include<iostream.h>
void main()
{
int list[50] ;
cout<<list<<endl;
}
output
0x236f2382
4.
false
#include<stdio.h>
#include<iostream.h>
int testBeta(int x, char v, int y);
void main()
{
cout<<testBeta(5,'A',2);
}
5.
true
#include<stdio.h>
#include<iostream.h>
void main()
{
int x,y;
x = 10;y = 20;
if((x >= 10) && (y > 20))
{
cout<<"true1"<<endl;
}
else if ((y > 20) || (x < y) )
{
cout<<"true2"<<endl;
}
else if((x >=10) || (x < y) )
{
cout<<"true3"<<endl;
}
else
{
cout<<"false"<<endl;
}
}
output
true 2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.