Class Quiz # 3 PF
Class Quiz # 3 PF
#include<iostream>
using namespace std;
int main()
{
cout << fun(10);
return 0;
}
a) 10
b) 0
c) Error
d) Segmentation fault
4. Which of the following is important in a function?
a) Return type
b) Function name
c) Both return type and function name
d) The return type, function name and parameter list
5. Which of the following correctly declares an array?
a) int array[10];
b) int array;
c) array{10};
d) array array[10];
6. What will be the output of the following C++ code?
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
char str[5] = "ABC";
cout << str[3];
cout << str;
return 0;
}
a) ABC
b) ABCD
c) AB
d) AC
7. What is the index number of the last element of an array with 9 elements?
a) 9
b) 8
c) 0
d) Programmer-defined