NEW
Font size
Worksheetsс+++
Total questions: 56
Worksheet time: 28mins
Which of the following is the output from the following C++ code?
15
15 14 13 12 11 10
15 14 13 12 11 10 9
9
If originally x=0, y=1, and z=3, what is the value of x, y, and z afterexecuting the following code ?
x=0 y=3 z=3
x=0 y=1 z=3
x=3 y=3 z=3
x=3 y=1 z=0
What is the value of x after the following statements?
10
33
3
0
What is the value of x after the following statements?
15
4
3
0
Which of the following is the output from the following C++?
5
0
4
6
Given the following code fragment, what is the final value of y?
2
8
4
3
Which of the following is the output from the following C++ code
10
12
3
4
Which of the following is the output from the following C++ code?
6
0
4
5
Which of the following is the final value of y from the following C++
2
3
22
0
Which of the following is the final value of ‘i’ from the following C++ code ?
4
5
0 1 2 3 4
0 1 2 3 4 5
What is the value of x after the following code executes?
10
11
13
0
Given the following code, what is the final value of i?
2
4
3
0
What is the value of x after the following code executes?
10
11
13
0
What is the output of the following code segment?
15
25
5
0
What does the following code print to the screen?
7
cout
int
world
What is the value of x after the following statements?
15
10
5
25
What is the value of x after the following statements?
25
4
5
1
What is the value of x after the following code executes?
10
11
23
13
Given the following code, what is the final value of i?
4
6
5
0
Given the following code, what is the final value of i?
4
6
5
0
Which of the following is the valid array declaration
int num(5)
int mycat[5]
Array. double[5] marks
Myarray.counter int[5]
What is the output of the following code?
7
Value
1
6
What is the output of the following code?
11
10
0
12
What is the final output of the following code fragment?
22
23
20
0
. Solve the following piece of code and choose the best answer
The function addition is called by passing the values
The function addition is called by passing reference
Both of abovе
None of above
If the type specifies of parameters of a function is followed by anampersand &, that function call is…
Pass by value
Pass by reference
All of answers
None of answers
Which of the following gives the memory address of a pointer pt1?
*pt1;
pt1;
&pt1;
address(prt1);
What is the value of x after the following statement
1,75
50
30
20
What is the final value of x after the following fragment of codeexecutes ?
Infinite loop
1
Never
0
What is the value of x after the following statement
3,75
1,75
2
0
What is the value of x after the following statements?
7
10
3
33
What is the value of x after the following statements?
70
30
3
33
Given the following code fragment, what is the output
5
Thats is all. Goodbye
X bigger than 5
X
How many times is "Hi" printed to the screen?
0
1
14
15
There is given array with n elements, created as pointer. How toremove it correctly
delete a;
delete[] a;
remove[] a;
remove a;
How to write correct recursive function for making sum of nnumbers?
This
This
This
This
How to make several items in structure? Just think that you have“HOME”, and n items in it
This
This
This
This
Find mistake of next cod?
Mistake in opening file, should be: file.open(“input.txt”);
It should write in other file; it can’t write directly to command line
No mistakes, it will just read from file and print first string in command line
It should read from read from file, when we want to write in command line.
What will print in command line next code?
Read first string from file “input.txt”, and print it in command line.
It will give an error, because, file should read in this way: file.open(“input.txt”);
It won’t print anything.
Read all lines and print it in new file.
Which libraries should be included to get string in a file?
<string> and <fstream>
<string> is enough
<fstream>is enough
<string> or <fstream>
Which one will be correct function for ?
This
This
This
This
There are given array “numbers” with 10 numbers. How to makesum of all numbers, which are located in odd indexes?
This
This
This
This
There is given string named “str”. How to print in command linelength of str?
cout << str.count();
cout << str.length;
cout << str.lenth();
cout >> str.lenth();
How to implement array of chars with 10 elements?
char* chs; chs = new char(10);
char chs; chs = char[10];
char chs[10];
char chs[] = new char[10];
How to implement array of integer numbers with n elements, andhow to delete them correctly?
int n; cin >> n; int* a; a = new% int[n]; delete[] a;
int n; cin >> n; int& a; a = new int[n]; delete[] a;
int n; cin >> n; int* a; a = new& int[n]; for(int
i=0; i<n; i++) delete a;
i=0; i<n; i++) delete a;
string s; getline(cin, s);
string s; getline(cout, s);
string s; cin >> s;
string s; cout << s;
How to get whole string in one line (in file)?
ifstream file; string s; getline(file, s);
ifstream file; string s; getline(cin, s);
ifstream file; string s; getline(cout, s);
ifstream file; string s; file >> s;
Why do we need library <fstream>?
To work with strings
To work with files.
To work with mathematical functions.
To work with our own libraries.
Why do we need library <cmath>?
To work with strings.
To work with mathematical functions.
To work with command line.
To work with our own libraries.
Where is the mistake of the code?
Variable “a” do not have any values.
Library <cmath> didn’t included.
Library <math.h> didn’t included.
Library <fstream> didn’t included.
What will be printed in the part of the cod?
1 4 7 10
0 3 6 9
3 6 9
9 6 3 0
What will be printed in the part of the code?
0 8 16 24 32
2 10 18 26 34
6 12 20 28 36
4 10 18 26 34
Which of the following is the proper keyword to allocate memory?
new
malloc
create
value
Which of the following is the proper keyword to deallocate memory?
free
delete
clear
remove
Assume if A = 10; and B = 15; with using bitwise OR operator Find A||B
10
15
61
13
"a" in line //1 equal to ?
1
-1
0
Error
