C# Quiz Results

Score: 25 of 25

100% Correct:


Question 1:

What is a correct syntax to output "Hello World" in C#?

Console.WriteLine("Hello World");    Your answer  
print ("Hello World");
System.out.println("Hello World");
cout << "Hello World";

Question 2:

C# is an alias of C++

False    Your answer  
True

Question 3:

How do you insert COMMENTS in C# code?

// This is a comment    Your answer  
# This is a comment
/* This is a comment

Question 4:

Which data type is used to create a variable that should store text?

string    Your answer  
str
myString
Txt

Question 5:

How do you create a variable with the numeric value 5?

int x = 5;    Your answer  
num x = 5
x = 5;
double x = 5;

Question 6:

How do you create a variable with the floating number 2.8?

double x = 2.8D;    Your answer  
int x = 2.8;
int x = 2.8D;
byte x = 2.8

Question 7:

Which property can be used to find the length of a string?

getLength()    Your answer  
Length    Correct answer  
length
length()

Question 8:

Which operator is used to add together two values?

The + sign    Your answer  
The & sign
The * sign

Question 9:

The value of a string variable can be surrounded by single quotes.

True    Your answer  
False    Correct answer  

Question 10:

Type casting is when you assign a value of one data type to another type.

True    Your answer  
False

Question 11:

Which operator can be used to compare two values?

==    Your answer  
=
><
<>

Question 12:

To declare an array in C#, define the variable type with:

{}    Your answer  
()
[]    Correct answer  

Question 13:

Array indexes start with:

0    Correct answer  
1

Question 14:

How do you create a method in C#?

MyMethod()    Your answer  
(MyMethod)
MyMethod.
myMethod[]

Question 15:

How do you call a method in C#?

MyMethod();    Your answer  
MyMethod;
myMethod[];
(MyMethod);

Question 16:

Which keyword is used to create a class in C#?

MyClass    Your answer  
className
class()
class    Correct answer  

Question 17:

What is the correct way to create an object called myObj of MyClass?

new myObj = MyClass();    Your answer  
MyClass myObj = new MyClass();    Correct answer  
class myObj = new MyClass();
class MyClass = new myObj();

Question 18:

In C#, it is possible to inherit fields and methods from one class to another.

False    Your answer  
True    Correct answer  

Question 19:

What is the name of the 'special' class that represents a group of constants?

const    Your answer  
special
enum    Correct answer  
void

Question 20:

Which operator is used to multiply numbers?

*    Your answer  
x
%
#

Question 21:

Which access modifier makes the code only accessible within the same class?

public    Your answer  
abstract
final
private    Correct answer  

Question 22:

How do you start writing an if statement in C#?

if (x > y)    Your answer  
if x > y:
if x > y then:

Question 23:

How do you start writing a while loop in C#?

while (x > y)    Your answer  
while x > y {
while x > y:
x > y while {

Question 24:

Which keyword is used to return a value inside a method?

void    Your answer  
return    Correct answer  
get
break

Question 25:

Which statement is used to stop a loop?

break    Your answer  
exit
return
stop