Forwarded from IS AM 2022 (M.almamari)
C++ provides a header file, which is used for file I/ called
Anonymous Quiz
41%
fstream
34%
ifstream
9%
ofstream
17%
1&2
Forwarded from IS AM 2022 (M.almamari)
C++ creates dynamic variables using
Anonymous Quiz
6%
delete operators
45%
Pointers
20%
new operators
29%
1&3
Forwarded from IS AM 2022 (M.almamari)
Choose the correct statement to initializing two-dimensional arrays in declarations.
Anonymous Quiz
23%
A. array<int<columns, rows>> n;
20%
B. array<int< rows, columns>> n;
34%
C. array<int<rows>columns> n;
23%
D. array<array<int, columns>, rows> n;
Forwarded from IS AM 2022 (M.almamari)
Which header file must be included to use the function steprecision?
Anonymous Quiz
19%
A. iostream
25%
B. fstream
16%
C. cmath
41%
D. iomanip
Forwarded from IS AM 2022 (M.almamari)
Consider the following declaration:
const size_t arraysize{4}; array<int,
arraysize> a{10,20,30,40}; In this declaration, identify the:
const size_t arraysize{4}; array<int,
arraysize> a{10,20,30,40}; In this declaration, identify the:
Anonymous Quiz
8%
A. The array name.
19%
B. The array size.
14%
C. The data type of each array component.
59%
D. All of the above
Forwarded from IS AM 2022 (M.almamari)
Forwarded from IS AM 2022 (M.almamari)
Forwarded from IS AM 2022 (M.almamari)
To add the output at the end of an existing file, you can use the option:
Anonymous Quiz
57%
A. ios::app
4%
B. ios::in
34%
C. ios::out
5%
D. ios::ate
Forwarded from IS AM 2022 (M.almamari)
The following program fragment __________.
#include <iostream>
using namespace std; main() { int x = 20; int *p = &x; *p=40; cout<<p<< &x; }
#include <iostream>
using namespace std; main() { int x = 20; int *p = &x; *p=40; cout<<p<< &x; }
Anonymous Quiz
36%
A. prints 40 and the address of x.
25%
B. results in a runtime error.
32%
C. prints the address of x twice.
6%
D. prints the address of p twice.
Forwarded from IS AM 2022 (M.almamari)
The following program __________.
#include <iostream>
using namespace std; void abc(int &p) { cout << p; } main() { float m = 1.23; abc(m); }
#include <iostream>
using namespace std; void abc(int &p) { cout << p; } main() { float m = 1.23; abc(m); }
Anonymous Quiz
29%
A. results in a compilation error
16%
B. results in a run time error
39%
C. prints 1.23
15%
D. prints 1
Forwarded from IS AM 2022 (M.almamari)
What is the output of the following C++ program?
#include <iostream>
using namespace std; main() { int a[] ={10,20,30}; int *p=&a[0]; p++; cout << *p+1; }
#include <iostream>
using namespace std; main() { int a[] ={10,20,30}; int *p=&a[0]; p++; cout << *p+1; }
Anonymous Quiz
9%
10
17%
20
51%
11
23%
21
Forwarded from IS AM 2022 (M.almamari)
What is the output of the following C++ code?
int num1; int num2; int *p = &num1; p = &num2; *p = 25; num1 =num2+ 6; p = &num1; num2 = 73; *p = 47; cout << *p << " " << num1 << " " << num2 << endl;
int num1; int num2; int *p = &num1; p = &num2; *p = 25; num1 =num2+ 6; p = &num1; num2 = 73; *p = 47; cout << *p << " " << num1 << " " << num2 << endl;
Anonymous Quiz
27%
A. 47 47 73
33%
B. 47 47 47
18%
C. 47 31 25
21%
D. None of above
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include <iostream>
#include <string>
using namespace std; int main(int argc, char const *argv[]) { char s1[6] = "Hello"; char s2[6] = "World"; char s3[12] = s1 + " " + s2; cout<<s3; return 0; }
#include <string>
using namespace std; int main(int argc, char const *argv[]) { char s1[6] = "Hello"; char s2[6] = "World"; char s3[12] = s1 + " " + s2; cout<<s3; return 0; }
Anonymous Quiz
2%
Hello
5%
World
57%
Error
36%
Hello World
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include <iostream>
#include <string> #include <algorithm> using namespace std; int main() { string s = "spaces in text"; s.erase(remove(s.begin(), s.end(), ' ' ), s.end() ) ; cout << s << endl; }
#include <string> #include <algorithm> using namespace std; int main() { string s = "spaces in text"; s.erase(remove(s.begin(), s.end(), ' ' ), s.end() ) ; cout << s << endl; }
Anonymous Quiz
44%
spacesintext
29%
spaces in text
20%
spaces " "
8%
spaces in
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
Which of the following is a correct identifier in C++?
Anonymous Quiz
80%
VAR_1234
10%
$var_name
7%
7VARNAME
3%
7var_name
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
Anonymous Quiz
10%
80 80
46%
81 80
6%
81 81
39%
Error
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include<iostream>
using namespace std;
enum Ayham { a = 1, b, c }; int main() { int x = c; int& y = x; int& z = x; y = b; cout << z--; return 0; }
using namespace std;
enum Ayham { a = 1, b, c }; int main() { int x = c; int& y = x; int& z = x; y = b; cout << z--; return 0; }
Anonymous Quiz
5%
1
16%
2
15%
3
37%
Error
1%
z—
27%
logical Error
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include<iostream>
int main()
{ int x = 10, y = 20; int* ptr = &x; int& ref = y; *ptr++; ref++; std::cout << x << " " << y; return 0; }
int main()
{ int x = 10, y = 20; int* ptr = &x; int& ref = y; *ptr++; ref++; std::cout << x << " " << y; return 0; }
Anonymous Quiz
18%
10 20
22%
10 21
16%
11 20
29%
11 21
14%
Error
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include<iostream>
int main()
{ int x = 100, y = 200; int* Ayham_s_ptr = &x; int& ref = y; (*Ayham_s_ptr)++; ref++; std::cout << x << " " << y; return 0; }
int main()
{ int x = 100, y = 200; int* Ayham_s_ptr = &x; int& ref = y; (*Ayham_s_ptr)++; ref++; std::cout << x << " " << y; return 0; }
Anonymous Quiz
4%
100 200
6%
101 200
32%
100 201
35%
101 201
15%
Error
7%
All of them //Brah
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include<iostream.h>
int main()
{ int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }
int main()
{ int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; }
Anonymous Quiz
8%
5 6 7 8 9 10
12%
5 6 7 8 9 10 7
28%
5 7
16%
5 5
23%
Error
9%
All of them // definitely Brah
4%
7 7
Forwarded from اللجنة العلمية CS 22 (Ayham Alakhlly)
#include<iostream>
using namespace std;
int main() { int m = 2, n = 6; int& x = m; int& y = n; m = x++; x = m++; n = y++; y = n++; cout << m << " " << n; return 0; }
using namespace std;
int main() { int m = 2, n = 6; int& x = m; int& y = n; m = x++; x = m++; n = y++; y = n++; cout << m << " " << n; return 0; }
Anonymous Quiz
18%
2 6
63%
4 8
11%
6 10
8%
Error