-
Notifications
You must be signed in to change notification settings - Fork 1
/
JoseGarcia.py
127 lines (110 loc) · 3.49 KB
/
JoseGarcia.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
myQs = {
11: {
"problem" : ["What is the output?",
" void main()",
" {",
" int x; ",
" x = float(9 * 1.0 / 2);",
" cout << x;",
" }"],
"answer" : "4.5"
},
12: {
"problem" : ["What is the output?",
"void main()",
" {",
" float x = 5, y = 2; ",
" cout << x % y;",
" }"],
"answer:" : "1"
},
13: {
"problem" : ["What is the output?",
"class Test",
" {",
" public:",
" int x; ",
" Test() { x = 6; }",
" int getX() {return x;}",
" };",
"void main()",
"{",
" Test t;",
" cout << t.getX();",
"}"],
"answer" : "6"
},
14 : {
"problem" : ["What is the output",
"int main()",
" {",
" char * ptr;",
" char Str[] = {\"abcdefg\"};",
" ptr = Str;",
" ptr += 5;",
" cout << ptr;",
" return 0;",
" }"],
"answer" : "fg"
},
15: {
"problem" : ["What is the output?",
"int main()",
" {",
" int x = 10, y = 20;",
" int *ptr = &x;",
" int &ref = y;",
" *ptr++;",
" ref++;",
" cout<< x + y;",
" return 0;",
" }"],
"answer" : "31"
},
16: {
"problem" : ["What is the output?",
"class Point",
" {",
" public:",
" Point() { cout << \"constructor called\"; }",
" };",
"void main()",
" {",
" Point *t1;",
" t1 = new Point();",
" }"],
"answer" : "constructor called"
},
17: {
"problem" : ["What is the output?",
"class X",
"{",
"public:",
" int x;",
"X(int xx)",
" {",
" x = xx",
" }",
"};",
"int main()",
" {",
" X a(10);",
" cout << a.x",
" return 0;",
" }"],
"answers" : "10"
},
18: {
"problem" : ["What is the output?",
" void MyFunction(int a, int b = 40)",
" {",
" cout<< a + b << endl; ",
" }",
"int main()",
" {",
" MyFunction(20, 30);",
" return 0;",
" }"],
"answer" : "50"
}
}