- 1

What is the output of this code?

static int Test(out int x, int y=4) { x = 6; return x * y; } static void Main(string[] args) { int a; int z = Test(out a); Console.WriteLine(a + z); }

18th Feb 2017, 7:34 PM
Emmanuel Makonga
38 Antworten
+ 8
The answer is 30
18th Feb 2017, 7:41 PM
Igor Makarsky
Igor Makarsky - avatar
+ 14
What is the output of this code? int * test() { static int x[4]; for(int i=0;i<4;i++){ x[i] = i%2; } return x; } int main() { int * arr = test(); printf("%d", *(arr+3)); } The output is 1
23rd Jul 2020, 6:16 AM
BIKRAM GHOSH
BIKRAM GHOSH - avatar
+ 2
14
8th Jun 2020, 9:08 AM
gashaw desalegn
gashaw desalegn - avatar
+ 1
The ans is not 24
28th Jun 2020, 6:24 PM
Faith Mundi
Faith Mundi - avatar
+ 1
What is the output of this code? class A def initialize(x) puts x/2 end end class B < A def initialize(y) super(y+2) end end ob = B.new(6) Answer: 4
21st Nov 2020, 6:11 AM
Jason Chew
Jason Chew - avatar
+ 1
answer is 30
9th Dec 2020, 5:01 PM
Turikumana Isaie
Turikumana Isaie - avatar
+ 1
What is the output of this code? 30
17th Dec 2020, 8:06 PM
Turikumana Isaie
Turikumana Isaie - avatar
+ 1
1 is the correct answer
10th Jul 2023, 6:21 AM
Vismaya S E
Vismaya S E - avatar
0
A compile error ^.^
18th Feb 2017, 7:46 PM
Tashi N
Tashi N - avatar
0
Compiles and runs just fine if it's wrapped in a class. Then the answer is 30. class Program { static int Test(out int x, int y=4) { x = 6; return x * y; } static void Main(string[] args) { int a; int z = Test(out a); Console.WriteLine(a + z); } }
18th Feb 2017, 9:32 PM
ChaoticDawg
ChaoticDawg - avatar
0
def unlucky_days(year) (1..12).count { |month| Time.new(year, month, 13).friday? } end year = 2017 puts unlucky_days(year) https://www.sololearn.com/discuss/276583/?ref=app
5th Apr 2017, 1:54 AM
111273
111273 - avatar
0
Test Test:: (Test obj) { newObj; newObj.mem = mem obj.mem; return newObj; }
14th Aug 2017, 2:44 PM
Zizipho Maginindane
Zizipho Maginindane - avatar
0
3
10th Feb 2019, 9:08 PM
Isah Baba Ibrahim
Isah Baba Ibrahim - avatar
0
3
14th Jul 2019, 11:03 AM
PRASAD MOHAN CHOUGALE
PRASAD MOHAN CHOUGALE - avatar
0
static void ______ (string[] args) { int x = (4 + 3) * 2; ____ .____ (x); } help me guys
14th Jul 2019, 6:23 PM
Stephano Wegbey
Stephano Wegbey - avatar
0
29th Jan 2020, 6:12 AM
Prajapati Divyang
Prajapati Divyang - avatar
0
What is the output of this code? int * test() { static int x[4]; for(int i=0;i<4;i++){ x[i] = i%2; } return x; } int main() { int * arr = test(); printf("%d", *(arr+3)); }
14th Apr 2020, 12:14 PM
Nishadevi V
0
1
30th Apr 2020, 1:12 PM
Nilesh Jadhawar
Nilesh Jadhawar - avatar
0
the ans is 1
30th Apr 2020, 1:15 PM
Nilesh Jadhawar
Nilesh Jadhawar - avatar
0
The correct ans is 3
17th Jun 2020, 1:27 PM
Tushar Mahmud