gs gs108 Looping Statements - IF Statements - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Looping Statements. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
static void Main(string[] args) { int i = 30; int j = 25 % 25; if (Convert.ToBoolean(Convert.ToInt32(i = j))) { Console.WriteLine("In if"); } else { Console.WriteLine("In else"); } Console.WriteLine("In main"); Console.ReadLine(); }
In if In main
In else In main
static void Main(string[] args) { int i; int b = 8, a = 32; for (i = 0; i <= 10; i++) { if ((a / b * 2)== 2) { Console.WriteLine( i + " "); continue; } else if (i != 4) Console.Write(i + " "); else break; } Console.ReadLine(); }
static void Main(string[] args) { int i, j; for (i = 2; i >= 0; i--) { for (j = 0; j <= 2; j++) { if (i == j) { Console.WriteLine("1"); } else { Console.WriteLine("0"); } } Console.WriteLine("\n"); Console.ReadLine(); } }
1 0 0 0 1 0 0 0 1
0 1 0 1 0 0 0 0 1
0 0 1 0 1 0 1 0 0
1 0 0 0 0 1 0 1 0
static void Main(string[] args) { int []num = {50, 65, 56, 88, 43, 52}; int even = 0, odd = 0; for (int i = 0 ;i < num.Length ;i++) { /*___________________________*/ } Console.WriteLine("Even Numbers:" +even); Console.WriteLine("Odd Numbers:" +odd); Console.ReadLine(); }
if ((num % 2) == 0) { even += 1; } else { odd += 1; }
if((num * i) == 0) { even += 1; } else { odd += 1; }
if(num[i] % 2 == 0) { even += 1; } else { odd += 1; }
if(num[i] % 2 = 0) { even += 1; } else { odd += 1; }
static void Main(string[] args) { int a = 15, b = 10, c = 1; if (Convert.ToBoolean(a) && (b > c)) { Console.WriteLine("cquestionbank"); } else { break; } }
static void Main(string[] args) { int a = 5; if (Convert.ToBoolean((.002f) -(0.1f))) Console.WriteLine("Sachin Tendulkar"); else if (a == 5) Console.WriteLine("Rahul Dravid"); else Console.WriteLine("Ms Dhoni"); Console.ReadLine(); }
static void Main(string[] args) { int a = -1; int b = -1; if (Convert.ToBoolean (++a = ++b)) Console.WriteLine("a"); else Console.WriteLine("b"); Console.ReadLine(); }
static void Main(string[] args) { int a = 5, b = 10; if (Convert.ToBoolean(Convert.ToInt32(0xB))) if (Convert.ToBoolean(Convert.ToInt32(022))) if (Convert.ToBoolean(Convert.ToInt32('\xeb'))) Console.WriteLine("java"); else ; else ; else ; }