CJCoding With Joseph
15free / daySign inCreate account
TitleOpen
733
Catch Divide By ZeroRead two integers a and b (each on its own line) and print a / b.
easyNot startedSolve
734
Parse Integer SafelyRead one line of input and parse it to an integer with int.Parse.
easyNot startedSolve
735
The finally BlockRead two integers and print Result: <a / b>.
easyNot startedSolve
736
Array Index Out Of RangeAn array arr = { 10, 20, 30 } is given.
easyNot startedSolve
737easyNot startedSolve
738easyNot startedSolve
746
List Index Out Of RangeA List<int> holds { 5, 10, 15 }.
easyNot startedSolve
748easyNot startedSolve
749easyNot startedSolve
750
finally Always RunsPrint Try, then throw an exception.
easyNot startedSolve
753
Null Reference ExceptionA variable text starts as null.
easyNot startedSolve
757easyNot startedSolve
758
Catch a Divide By ZeroRead two integers a and b (one per line), then print the result of a / b.
easyNot startedSolve
759
Handle Invalid Number FormatRead one line of input and parse it to an int with int.Parse, then print Number: <n>.
easyNot startedSolve
760
Read the Exception MessageThe try block throws new InvalidOperationException("operation not allowed").
easyNot startedSolve
761
Catch Any ExceptionRead an integer n and print 100 / n.
easyNot startedSolve
762
The finally Block Always RunsRead an integer and print Parsed: <n>.
easyNot startedSolve
763easyNot startedSolve
764
Null Reference HandlingThe variable text is set to null.
easyNot startedSolve
765
Catch the Base ArithmeticExceptionRead two integers and print a / b.
easyNot startedSolve
766
Print the Exception Type NameRead an integer and print Value: <n>.
easyNot startedSolve
767
Convert.ToInt32 Can Throw TooRead a line and convert it with Convert.ToInt32, then print Doubled: <n2>.
easyNot startedSolve
768
Recover With a Default ValueTry to parse the input into a variable named value.
easyNot startedSolve
769
Substring Out Of RangeRead a string and print its first three characters using s.Substring(0, 3).
easyNot startedSolve
739
Multiple Catch BlocksRead two integers and print their quotient.
mediumNot startedSolve
740
Custom Exception ClassDefine a custom exception InsufficientFundsException that inherits from Exception and takes a message.
mediumNot startedSolve
742
Exception Filter With whenRead an integer status code.
mediumNot startedSolve
743
Checked OverflowRead two integers and add them inside a checked(...) expression, then print Sum: <sum>.
mediumNot startedSolve
744
ArgumentNullExceptionRead one line.
mediumNot startedSolve
745
Key Not Found In DictionaryA dictionary maps Alice -> 30 and Bob -> 25.
mediumNot startedSolve
751
Validate Percentage RangeRead an integer percent.
mediumNot startedSolve
752
Overflow On Byte CastRead an integer n and convert it to a byte using checked((byte)n), then print Byte: <b>.
mediumNot startedSolve
755
Identify The Exception TypeRead an integer n.
mediumNot startedSolve
770
Two Catch BlocksRead two integers and print a / b.
mediumNot startedSolve
771
Overflow When Parsing a ByteRead a line and parse it into a byte (which holds 0 to 255) using byte.Parse, then print Byte: <b>.
mediumNot startedSolve
772mediumNot startedSolve
773
Missing Dictionary KeyA Dictionary<string, int> maps names to ages (Alice=30, Bob=25).
mediumNot startedSolve
774
Filter With a when ClauseRead an integer code, then throw new InvalidOperationException(code.ToString()).
mediumNot startedSolve
775
Nested Try/CatchRead an integer n.
mediumNot startedSolve
776mediumNot startedSolve
777
Validate a RangeRead a score.
mediumNot startedSolve
778
Throw From a MethodRead an integer n and print Result: <100 / n> using a helper method DivideHundred(int x) that returns 100 / x but throws new DivideByZeroException() when x is 0.
mediumNot startedSolve
790
Catch An Invalid CastAn object variable can hold any type, but unboxing it to the wrong type throws an InvalidCastException.
mediumNot startedSolve
741
Rethrow With Nested TryRead an integer n.
hardNot startedSolve
747
Custom Exception With DataDefine a custom exception NegativeNumberException that stores the rejected number in an int Value property.
hardNot startedSolve
754
Wrap With Inner ExceptionUse a nested try/catch.
hardNot startedSolve
756
Function That ThrowsRead two integers and print Result: <Divide(a, b)>.
hardNot startedSolve
779
Define a Custom ExceptionDefine your own exception class NegativeNumberException that extends Exception and passes a message to the base constructor.
hardNot startedSolve
780
Rethrow With throw;Read an integer n.
hardNot startedSolve
781
Custom Exception With Data and finallyDefine an InsufficientFundsException with an int Shortfall property set through its constructor.
hardNot startedSolve