




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Choose the namespace inChoose the namespace in which the interface IEnumerable is declared?which the interface IEnumerable is declared? A.A. System.CollectSystem.Collectionsions C. Both A and BC. Both A and B D. None of theD. None of the mentionedmentioned B.B. System.CollectioSystem.Collections.Genericns.Generic ๎or the !i"en set of code what is output?๎or the !i"en set of code what is output? class #ro!ramclass #ro!ram $$ staticstatic "oid"oid %ain&strin!%ain&strin!'('( ar!s)ar!s) $$ int'(int'( numsnums ** $$ +,+, -๎,-๎, /,/, 0,0, -1,-1, 22 3434 "ar"ar posNumsposNums ** nums.5hernums.5here&ne&n 66 nn 77 +0).Select&r+0).Select&r 66 r8/)4r8/) Console.5Console.5rite&9:herite&9:he "alues"alues inin nums;nums; 9)49) foreachforeach &int&int ii inin posNums)posNums) Console.5rite&iConsole.5rite&i << 99 9)49) Console.5rite=ine&)4Console.5rite=ine&) Console.>ead=ine&)4Console.>ead=ine&) 33 33
un time error>un time error Compile time errorCompile time error ๎ -+ 0 0 -๎ +๎ -+ 0 0 -๎ +
System.:e๎tSystem.:e๎t System.Collections.GenericSystem.Collections.Generic [email protected]๎[email protected]๎pressions System.=in@System.=in@ ๎or the !i"en set of code what is output?๎or the !i"en set of code what is output? class #ro!ramclass #ro!ram $$ staticstatic "oid"oid %ain&strin!%ain&strin!'('( ar!s)ar!s) $$ int'( nums * $ +, -๎, -/, 2int'( nums * $ +, -๎, -/, 2 3434 "ar "ar posNumsposNums ** fromfrom nn inin numsnums orderbyorderby nn descendin!descendin! selectselect n๎1n๎1 ๎๎ ๎4๎ Console.5 Console.5rite&9:herite&9:he "alues"alues inin nums;nums; 9)49) foreach foreach &int&int ii inin posNums)posNums) Console.5Console.5rite&irite&i << 99 9)49) Console.5rite=ine&)4Console.5rite=ine&) Console.>ead=ine&)4Console.>ead=ine&) 33 33
un time error>un time error +0 ๎ -1 -๎ +0 ๎ -1 -๎
๎or the !i"en set of code what is output representin!?๎or the !i"en set of code what is output representin!? class #ro!ramclass #ro!ram $$ staticstatic "oid"oid %ain&strin!%ain&strin!'('( ar!s)ar!s) $$ int'(int'( numsnums ** $$ +,+, -๎,-๎, /,/, 0,0, -1,-1, 22 3434 "ar"ar posNumsposNums ** fromfrom nn inin numsnums wherewhere nn 66 00 selectselect n4n intint lenlen ** posNums.CouposNums.Count&)4nt&) Console.5rite=ine&len)4Console.5rite=ine&len) Console.>ead=ine&)4Console.>ead=ine&) 33 33 E๎ecution of code with nothin! bein! printedE๎ecution of code with nothin! bein! printed
un time error>un time error E๎ecution of code with countin! total numbers !reater than ๎eroE๎ecution of code with countin! total numbers !reater than ๎ero E๎ecution of code with printin! all numbersE๎ecution of code with printin! all numbers Select the output for !i"en code snippet;Select the output for !i"en code snippet; class #ro!ramclass #ro!ram $$ static "oid %ain&strin!'( ar!s)static "oid %ain&strin!'( ar!s) $$ int'( nums * $+34int'( nums * $+
"ar posNums * from n in nums where n 6 0 select %ath.%a๎&๎F, ๎) Console.5rite&9:he lar!est "alues in nums; 9) foreach &int i in posNums) Console.5rite&i < 9 9) Console.5rite=ine&) Console.>ead=ine&) 3 3 code run successfully print nothin! Compile time error code run successfully print re@uired output
un time error 5hat will be the output of !i"en code snippet? class #ro!ram $ static "oid %ain&strin!'( ar!s) $ int'( nums * $ +, -๎, /, 0, -1, 234 "ar posNums * from n in nums where n 6* 0 select n foreach &int i in posNums) Console.5rite&i < 9 9)
un time error code run successfully print nothin! code run successfully print re@uired output Compile time error Select the output for !i"en code snippet; class #ro!ram $ static "oid %ain&strin!'( ar!s) $ int'( nums * $ +, -๎, /, 0, -1, 2 34 "ar posNums * from n in nums where n 6 -2 HH n 7 ๎ orderby n descendin! select n Console.5rite&9Descendin! order in nums; 9) foreach &int i in posNums) Console.5rite&i < 9 9) Console.5rite=ine&) Console.>ead=ine&) 3 3 Compile time error #rint nothin! code run successfully Arran!ed in descendin! order code run successfully
un time error #lease read the @uestions carefully and choose the most appropriate option. 5hich of the !i"en options are :>๎E about the Strin! Class in CJ.NE:? A strin! built usin! Strin! Class is Immutable. All the listed options A strin! built usin! Strin!Builder Class is %utable. :wo strin!s can be concatenated by usin! an e๎pression of the form s/ * s+ < s๎ #lease read the @uestions carefully and choose the most appropriate option.5hich of the followin! components of the .NE: frameworK pro"ide an e๎tensible set of classes that can be used by any .NE: compliant pro!rammin! lan!ua!e? +..NE: class libraries ๎.Component LbMect %odel only ๎ Both + and ๎ only + None of the listed options :he output of code is? class test $ public "oid print&) $ Console.5rite=ine&9Csharp;9) 3 3
false true Select the output for followin! set of code ; class sample $ public int i public int M public "oid fun&int i, int M) $ this.i * i this.M * M 3 3 class #ro!ram $ static "oid %ain&strin!'( ar!s) $ sample s * new sample&) s.i * + s.M * ๎ s.fun&s.i, s.M) Console.5rite=ine&s.i < 9 9 < s.M) Console.>ead=ine&) 3 3
un successfully but prints nothin!
Error as PthisQ reference would not be able to call PiQ and PMQ Error while callin! s.fun&) due to inaccessible le"el Select output for followin! set of code. class sample $ public int i public int'( arr * new int'+0( public "oid fun&int i, int "al) $ arr'i( * "al 3 3 class #ro!ram $ static "oid %ain&strin!'( ar!s) $ sample s * new sample&) s.i * + sample.fun&+, 2) s.fun&+, 2) Console.>ead=ine&) 3 3 sample.fun&+, 2) will set "alue as 2 in arr'+(
class #ro!ram $ static "oid %ain&strin!'( ar!s) $ sample s * new sample&) s.i * + sample.fun&+, 2) s.fun&+, 2) Console.>ead=ine&) 3 3 sample.fun&+, 2) will not worK correctly s.fun&+, 2) will worK correctly sample.fun&+, 2) will set "alue as 2 in arr'+( s.i * +0 cannot worK as i is PpublicQ Select output for followin! set of code ; CLN:>L= S:>๎C:๎>ES static "oid %ain&strin!'( ar!s) $ int ๎ for &๎ * +04 ๎ 7* +24 ๎<<) while &Con"ert.:oBoolean&Con"ert.:oInt/๎&๎))) $ do $
Console.5rite=ine&+) if &Con"ert.:oBoolean&๎ 66 +)) continue 3while &Con"ert.:oBoolean&0)) breaK 3 Console.>ead=ine&) 3 0 0 0R.in๎nite times System outoTow e๎ception error.
num <* ๎ Console.5rite=ine&num) 3
++ ๎+ ๎+ ++ ๎+
๎+ ๎+ ๎+ ๎+ ๎+ ๎+ 5hat will be the output for !i"en set of code? static "oid %ain&strin!'( ar!s) $
int '(arr * new int'($ +, ๎, /, 1, 234 fun &ref arr) for &int i * 04 i 7 arr.=en!th 4 i<<) Console.5rite=ine& arr'i( < 9 9) 3 static "oid fun&ref int'(a) $ a * new int'๎ ( a'/( * /๎ a'+( * ๎ 3 0 ๎ 0 /๎ 0 0 0 0 /๎ 0 0 0 ๎ 0
5hat will be the correct output for !i"en code snippet? class maths $ public int fact&int n) $ int result if &n ** +) return + result * fact&n - +) ๎ n return result 3 3 class Lutput $ static "oid %ain&Strin!'( ar!s) $ maths obM * new maths&) 4 Console.5rite=ine&obM.fact&1)๎obM.fact&๎)) 3 3 ๎ 1F ๎ +๎ 5hich method does followin! set of code e๎plains? static "oid %ain&strin!'( ar!s)
int a * +0, b * ๎ method&ref a, ref b) console.writeline&a < 9 9 < b) 3 static "oid swap&ref int i, ref int M) $ int t t * i i * M M * t 3 Call by reference Call by "alue parameter arrays Lutput parameter 5hat will be the correct output for !i"en code snippet? class maths $ public int fact&int n) $ int result if &n ** +) return + result * fact&n - +) ๎ n return result