What is a correct syntax to output "Hello World" in C#? (A) System.out.println("Hello World"); (B) Console.WriteLine("Hello World"); (C) print ("Hello World"); (D) cout << "Hello World";
C# is an alias of C++ (A) True (B) False
How do you insert COMMENTS in C# code? (A) # This is a comment (B) /* This is a comment (C) // This is a comment
Which data type is used to create a variable that should store text? (A) str (B) Txt (C) string (D) myString
How do you create a variable with the numeric value 5? (A) num x = 5 (B) x = 5; (C) double x = 5; (D) int x = 5;
How do you create a variable with the floating number 2.8? (A) byte x = 2.8 (B) int x = 2.8D; (C) double x = 2.8D; (D) int x = 2.8;
Which property can be used to find the length of a string? (A) length (B) Length (C) getLength() (D) length()
Which operator is used to add together two values? (A) The + sign (B) The * sign (C) The & sign
The value of a string variable can be surrounded by single quotes. (A) False (B) True
Type casting is when you assign a value of one data type to another type. (A) True (B) False
Which operator can be used to compare two values? (A) <> (B) >< (C) == (D) =
To declare an array in C#, define the variable type with: (A) {} (B) () (C) []
Array indexes start with: (A) 1 (B) 0
How do you create a method in C#? (A) MyMethod() (B) (MyMethod) (C) myMethod[] (D) MyMethod.
How do you call a method in C#? (A) MyMethod(); (B) MyMethod; (C) myMethod[]; (D) (MyMethod);
Which keyword is used to create a class in C#? (A) className (B) class (C) MyClass (D) class()
What is the correct way to create an object called myObj of MyClass? (A) new myObj = MyClass(); (B) class MyClass = new myObj(); (C) class myObj = new MyClass(); (D) MyClass myObj = new MyClass();
In C#, it is possible to inherit fields and methods from one class to another. (A) False (B) True
What is the name of the 'special' class that represents a group of constants? (A) special (B) void (C) const (D) enum
Which operator is used to multiply numbers? (A) * (B) % (C) # (D) x
Which access modifier makes the code only accessible within the same class? (A) abstract (B) final (C) public (D) private
How do you start writing an if statement in C#? (A) if x > y then: (B) if x > y: (C) if (x > y)
How do you start writing a while loop in C#? (A) while x > y: (B) while x > y { (C) x > y while { (D) while (x > y)
Which keyword is used to return a value inside a method? (A) break (B) void (C) get (D) return
Which statement is used to stop a loop? (A) exit (B) stop (C) break (D) return