1.The put function outputs Select one: a. one character value. b. one float valu
ID: 3773419 • Letter: 1
Question
1.The put function outputs
Select one:
a. one character value.
b. one float value.
c. one integer value.
d. one double value.
2.Which function returns TRUE if the character argument is a letter?
Select one:
a. isdigit
b. islower
c. isalpha
d. isspace
3.Streams may be passed to a function.
Select one:
True
False
4.' ' is two characters.
Select one:
True
False
5.What are the valid indexes for the array shown below?
int myArray[25];
Select one:
a. 0-25
b. 0-24
c. 1-25
d. 1-24
Select one:
a. Array indexes start at 1 not 0.
b. Arrays must be integers.
c. Array indexes must be less than the size of the array.
d. Should be cin >> scores[0];
7.If we want a search function to search an array for some value and return either the index where the value was found, or -1 if not found, which of the following prototypes would be appropriate?
Select one:
a. void search(const int array, int target, int numElements);
b. void search(const int array, int target);
c. int search(const int array[], int numElements);
d. int search(const int array[], int target, int numElements);
8.Given the following function definition, what modifications need to be made to the search function so that it finds all occurrences of target in the array?
int search(const int array[], int target, int numElements)
Select one:
a. Add another parameter to indicate where to stop searching.
b. Add another parameter to indicate where to start searching.
c. This already can find all occurrences of a given target.
d. Have the function return the whole array.
9.strcmp(first, second) returns
Select one:
a. <0 if first < second, 0 if first == second, positive otherwise.
b. true if first=second, false otherwise.
c. nothing, it's a void function.
d. >0 if first < second, 0 if first > second, <0 otherwise.
10.What is wrong with the following code fragment?
Select one:
a. nothing
b. p1 and p2 both have the same value, so the delete p2 will cause an error
c. You have a memory leak.
d. p1 and p2 both have the same value, so the delete p2 will cause an error and You have a memory leak.
11.int *p1; declares a static variable.
Select one:
True
False
Select one:
a. DateType today(1,1,2000);
b. DateType today = (1,1,2000);
c. DateType today = {1,1,2000);
d. DateType today = {1,1,2000,0);
13.Given the following code fragment, which of the following expressions is always TRUE?
int x;
cin >> x;
Select one:
a. if( x < 3)
b. if( x==1)
c. if( (x / 3) >1 )
d. if( x = 1)
14.
Select one:
a. 3
b. 4
c. 5
d. 0
Explanation / Answer
1)
The correct option is a. one character value.
Explanation: The put function takes one character value
and print the chracter on console.
------------------------------------------------------------------------------------
2)
The correct option is c.isalpha
Explanation: The method isalpha check whether
the given character is printable alphbatic letter.
------------------------------------------------------------------------------------
3)
The correct answer is True
Explanation : The stream objcts can be passed as
arguments to functions to read or write to files
the data or from the files.
------------------------------------------------------------------------------------
4)
The correct answer is False
Explanation : The character ' ' is single line character
that represents the new line that give a new line and start from
the next line while printing to console or text file.
------------------------------------------------------------------------------------
5)
The correct option is b. 0- 24
Explanation : The integer array int myArray[25] is
an array of type integer of size 25.
The array starts from index =0 to index =size-1=25-1=24
------------------------------------------------------------------------------------
6)
Figure is missing , not visible
------------------------------------------------------------------------------------
7) The correct option is
d. int search(const int array[], int target, int numElements);
Explanation:
The funtion that takes an integer array, target value to search
and number of elemements in the array.
------------------------------------------------------------------------------------
8)
Figure is missing , not visible
------------------------------------------------------------------------------------
9)
The correct option is
a. <0 if first < second, 0 if first == second, positive otherwise.
Explanation:
The function strcmp that takes two character array strings
and return <0 if first <second
0 if first ==second
>0 first >second
------------------------------------------------------------------------------------
10)Figure is missing , not visible
------------------------------------------------------------------------------------
11.)
The correct answer is False
Explanation:
int *p1; declares a non - static variable that creates pointer variable p1 of type integer
static variables are followed by static keyword .
------------------------------------------------------------------------------------
12.)
The correct option is
d. DateType today = {1,1,2000,0);
Explanation : The DateType today can have
either ( or { but not combiation of { and )
------------------------------------------------------------------------------------
13.)
The correct option is
d. if( x = 1)
Explanation :
The expression if(x=1) is assignment of value 1 to x which
is always true so if condition is always returns true,1
------------------------------------------------------------------------------------
14.)Figure is missing , not visible
Note :figures with .gif not visible.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.