1. Which of the following code snippets are the correct way to determine whether a is Odd or Even? int a; String res; if (a % 2 == 0) res = "Even"; else res = "Odd"; int a; String res; if (a Mod 2 == 0) res = "Even"; else res = "Odd"; int a; Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd"); int a; String res; a % 2 == 0 ? res = "Even" : res = "Odd"; Console.WriteLine(res);






Write Comment

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

Tags
Show Similar Question And Answers
QA->In a Program Graph, ‘X’ is an if-then-else node. If the number of paths from start node to X is ‘p’ number of paths from if part to end node is ‘q’ and from else part to end node is ’r’, the total number of possible paths through X is :....
QA->Twice World Cup Football winners Argentina sacked their coach on April 10, 2017 after a string of poor results. ? Name that coach?....
QA->In a certain code SUNDAY is coded as USDNYA. How could CREATION be written in that code?....
QA->To construct a binary Mod-N counter, the number of flip-flops needs is:....
QA->A PERSON WHO STEALS WORDS AND IDEAS FROM SOMEONE ELSE""S WORK IS KNOWN AS....
MCQ->Which of the following code snippets are the correct way to determine whether a is Odd or Even? int a; String res; if (a % 2 == 0) res = "Even"; else res = "Odd"; int a; String res; if (a Mod 2 == 0) res = "Even"; else res = "Odd"; int a; Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd"); int a; String res; a % 2 == 0 ? res = "Even" : res = "Odd"; Console.WriteLine(res);....
MCQ->What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class SampleProgram { static void Main(string[ ] args) { int i; int res = fun(out i); Console.WriteLine(res); } static int fun (out int i) { int s = 1; i = 7; for(int j = 1; j <= i; j++) { s = s j; } return s; } } }....
MCQ->What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class Sample { public static void fun1() { Console.WriteLine("Bix1 method"); } public void fun2() { fun1(); Console.WriteLine("Bix2 method"); } public void fun2(int i) { Console.WriteLine(i); fun2(); } } class MyProgram { static void Main(string[ ] args) { Sample s = new Sample(); Sample.fun1(); s.fun2(123); } } }....
MCQ->What is the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { public enum color { red, green, blue }; class SampleProgram { static void Main (string[ ] args) { color c = color.blue; switch (c) { case color.red: Console.WriteLine(color.red); break; case color.green: Console.WriteLine(color.green); break; case color.blue: Console.WriteLine(color.blue); break; } } } }....
MCQ->Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it? using System; namespace IndiabixConsoleApplication { class MyProgram { static void Main(string[] args) { int index; int val = 44; int[] a = new int[5]; try { Console.Write("Enter a number:"); index = Convert.Tolnt32(Console.ReadLine()); a[index] = val; } catch(FormatException e) { Console.Write("Bad Format"); } catch(IndexOutOfRangeException e) { Console.Write("Index out of bounds"); } Console.Write("Remaining program"); } } }....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions