7 552
Subscribers
-524 hours
-327 days
-14730 days
Posts Archive
57 string str = ",.,.,.The five flying wizards jump quickly.,.,.,".__(new[] { '.', ','});// str == ",.,.,.The five flying wizards jump quickly"
TrimEnd
Replace
Remove
ReplaceLineEndings
EndsWith
A
51 Choose the class relationships that are NOT the forms of the "has-a" relationship.
Inheritance
Composition
Aggregation
Association
Dependency
A
50 string[] s = { "A", "B", "C", "D", "E", "F", "G", "H" };string Join(string[] s){ // string.Join concatenates the elements of a specified array using the the empty string as a separator between each element. return string.Join(string.Empty, s);}
Join(s[2..5]) == "CDEF"
Join(s[..^5]) == "ABC"
Join(s[0..3]) == "ABC"
Join(s[^7..^4]) == "ABC"
Join(s[^2..]) == "FGH"
A
49 void Foo(int i, string? str){ if (i == 0) { throw new ArgumentException("i equals zero.", nameof(i)); } if (i < -5 || i > 5) { throw new ArgumentOutOfRangeException(nameof(i)); } if (str is null) { throw new ArgumentNullException(nameof(str)); }}void Bar(int i, string? str){ try { Foo(i, str); } catch (ArgumentOutOfRangeException) { Console.Write("A"); } catch { Console.Write("B"); } finally { Console.Write("C"); }}
The Bar(0, string.Empty) method invocation will print “BC” to the console.
The Bar(-6, string.Empty) method invocation will print “AC” to the console.
The Bar(1, null) method invocation will print “BC” to the console.
The Bar(0, string.Empty) method invocation will print “C” to the console.
The Bar(6, string.Empty) method invocation will print “A” to the console.
C
46 string str1 = new string("abc123");string str2 = "abc" + "123";
str1 == str2
(object)str1 == (object)str2
str1.Equals(str2)
(str1 as object).Equals(str2)
object.ReferenceEquals(str1, str2)
A&C
45 (1){ Foo();}(2){ Bar();}(3){ Qux();}void Foo() { (4) new Exception(); }void Bar() { Console.WriteLine("Handle exception."); }void Qux() { Console.WriteLine("Program is finished."); }
(1) try, (2) catch, (3) finally, (4) throw
(1) throw, (2) catch, (3) finally, (4) try
(1) catch, (2) finally, (3) try, (4) throw
(1) try, (2) finally, (3) catch, (4) throw
(1) throw, (2) finally, (3) catch, (4) try
Ans ; A
44 void Foo(int i){ if (i < 0 || i > 10) { // The exception object must have the correct parameter name, as well as the exception message, if any. throw new ...; }}
ArgumentOutOfRangeException("i")
ArgumentOutOfRangeException(nameof(i))
ArgumentOutOfRangeException("i", "i is less then zero or greater then ten.")
ArgumentOutOfRangeException("i is less then zero or greater than ten.")
ArgumentOutOfRangeException("i is less then zero or greater than ten.", nameof(i))
Ans : C
40 What type is the base type for all types in .NET?
The System.Object class.
The System.ValueType class.
The System.Base class.
The System class.
There is no base type in .NET that is common for all data types.
Ans:C
38 Choose the INCORRECT property declarations.
public int Value { get { return 0; } set { } }
public Value(int);
public int Value { get; }
public int Value;
public int this[int i] { get { return 0; } }
And; D
// Foo(10) == 10?// Bar(10) == 10?// Qux(10) == 10?int Foo(int n){ int i, counter = 0; for (i = n; i >= 0;) { i--; counter++; } return counter;}int Bar(int n){ int i = 0, counter = 0; while (true) { counter++; if (i == n) break; i++; } return counter;}int Qux(int n){ int i = n, counter = 0; do { counter++; i--; } while (i > 0); return counter;}
Foo
Bar
Qux
Ans: QUX
*COGNIZANT*
Year of passed:- 2021,2022,2023.
Percentage 60% through out the academics.
B Tech(All Branches)
Package:- 4.5L
Drive Date : May 7th
We only did 3 questions . Still 40 min left
100% clearance for any exam
Contact us : @mlcoder2
#idp
