JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Programming fundamentals in C#
A quiz that aims to check if you understand the basics of programming and Visual Studio.
A score of 30 points+ (out of 60 total) is needed to advance to the next chapter.
Sign in to Google
to save your progress.
Learn more
* Indicates required question
In order to declare a local variable you need to provide:
*
2 points
Type
Name
Value
Required
In order to use a local variable, it must have a value assigned explicitly.
*
1 point
True
False
Required
Which of the following is invalid?
*
3 points
'a' - 'b'
1-'a'
1 + 5.1
"a" - "b"
Required
Which of the following are types for whole numbers?
*
1 point
int
float
double
decimal
short
byte
Required
Which of the following are types for numbers with a fraction?
*
1 point
int
float
double
decimal
short
byte
Required
var number = 4.0f // What type is number?
*
1 point
int
float
double
decimal
var
Required
var number = 1 + 4.0f // What type is number?
*
1 point
int
float
double
decimal
var
Required
var a = "a"; // what type is a?
*
1 point
var
string
char
Required
Console.WriteLine("5 / 2"); // what does this print?
*
1 point
"5 / 2"
5 / 2
2.5
2
3
1
Required
Console.WriteLine(5 / 2); // what does this print?
*
1 point
5 / 2
2.5
2
3
1
Required
Console.WriteLine(5 / 2.0); // what does this print?
*
1 point
5 / 2
2.5
2
3
1
What is git?
*
1 point
Code versioning host
Code versioning system
Language for managing deleted code
Which of the following does not belong to git?
*
3 points
Working tree
Staging area
Central unit
Repository
Stash
Push area
Required
Which git command is involved for moving files from working directory to staging area?
*
1 point
add
commit
push
reset
stash
merge
Which git command is involved for moving files from local to remote repository?
*
1 point
add
commit
push
reset
stash
merge
Which git command is involved for moving files from staging area to local repository?
*
1 point
add
commit
push
reset
stash
merge
Which command is used to move files to safe place locally for later working with them?
*
1 point
add
commit
push
reset
stash
merge
When will merge conflict happen?
*
1 point
When branch A has changes that branch B does not (different files)
When branch A has changes that branch B does (different files)
When branch A has changes that branch B does (same files, same place)
When branch A has changes that branch B does not (same files, same place)
Required
Every function must have a return statement.
*
1 point
True
False
In order to declare a function you must give it:
*
2 points
Return type
Name
Arguments
Access modifier
Required
You have the following piece of code. Refer to the 3 questions below and answer them.
Which of the following is true about Foo and Bar?
*
2 points
Bar is invalid because it uses a variable that does not exist
Foo is invalid because a is not static
Bar won't compile because it cannot do anything else after a return statement
Required
FooBar is invalid because:
*
2 points
It has no access modifier
It has no return type
It doesn't return anything
It has no arguments
It's not static
Required
What's wrong with function Sum?
*
1 point
It's not static
a is already declared in Foo method
Which numbers will return true passed to IsValidNumber function?
*
3 points
5
6
7
8
9
10
11
Required
Which loop is the most appropriate for iterating over an array of numbers? INDEX DOES NOT MATTER
*
2 points
for
foreach
while
do while
Which loop is the most appropriate for iterating over an array of string? INDEX DOES MATTER
*
2 points
for
foreach
while
do while
Which of the following can stop the loop completely?
*
2 points
break
continue
stop
return
Required
Which is not a valid way of declaring array in C#?
*
2 points
int[] a = {1, 2, 3}
var a = new int[] {1,2,3}
var a = new [] {1, 2, 3}
All are valid
What will be printed?
*
2 points
ASD
Kaisinel
DKaisinel
Aisinel
ASDK
What will the output be?
*
1 point
0
1
null
NullReferenceException
""
What will the output be?
1 point
t
o
Clear selection
What will the output be?
*
1 point
m
IndexOutOfRangeException
t
NullReferenceException
What is a breakpoint?
*
1 point
A line of code that throws an error
A line of code that you are currently typing at
A line of code that you mark to pause application during debug mode
A line of code that you mark to quit application during debug mode
While debugging in VS, how to go back to the line executed before?
1 point
Click the back button
Drag cursor for line currently being executed to the line you want to go back to
It's impossible to go back to previous line
Clear selection
What is a Watch?
*
2 points
A window to observe memory and CPU usage
A window to see local variables
A window to pin expressions of choice
What is the purpose of an Immediate Window?
*
2 points
Pin expressions of choice
Run code using your application context while debugging
See local variables
Observe memory and CPU usage
Which best define a stream?
*
1 point
File
string
Sequence of bytes
In memory data
File "C://Out.txt" does not exist. What happens if you do: File.WriteAllText("C://Out.txt", "Hello out!");
*
1 point
It will fail with FileNotFoundException
A new empty file will be created
A new file with "Hello out!" will be created
It will fail with NullReferenceException
Which of the following is a way of generating a random number between 0.1 and 0.5 given Random random = new Random(); Note: Presume that all random signatures are correct.
*
2 points
random.NextDouble() * 0.5;
random.Next(10, 50) / 100.0
random.Next(10, 50) / 100
Required
Caesar cypher is based on which operation?
*
1 point
*
/
+
What could be a reason of 😀 sign appearing as ? instead?
*
2 points
Saving string as Unicode
Saving string as ASCII
Saving string as UTF-16
Saving string as UTF-32
Submit
Clear form
This content is neither created nor endorsed by Google.
Report Abuse
-
Terms of Service
-
Privacy Policy
Forms