-
Why are the instructors sharing most of the material in odt, docx, pdf, html and md?
- To insure compatibility across operating systems (Android, Linux, Windows, MacOs, …).
- To make it easier to access the resources in multiple ways (print, screen, etc.)
- All of the above.
-
What does “free” software means?
- That the software has no value.
- That the users can run the software for any purpose and study its source code.
- That it is not developed by a company.
- That the software can be downloaded at no cost.
-
In your IDE, the shortcut to compile your program is usually…
- “Build your solution”, ctrl + shift + B or Cmd + B
- “Save”, ctrl + S or Cmd + S
- “Exit”, alt + F4 or Cmd + q
- “Start without debugging”, Ctrl + F5 or Cmd + F5
-
To share or backup a project, you need to…
- share the .sln file.
- share the .cs file.
- share the .csproj file.
- zip the folder containing the .sln file and another folder with multiple files and folders in it.
-
If your IDE returns the message
This means that…
- That you misspelled the word “WriteLine”.
- Your program successfully compiled and is ready to be executed.
- That the “Console” class does not exist.
- Your IDE was not properly installed and you should reboot your computer.
-
Consider the following code:
Which of the following is correct?
- It contains declaration and initialization statements.
- It declares variables of two different datatypes.
- Only the value of
defaultChoice
is set. - All of the above.
-
Consider the following code:
What will be displayed by it?
- Nothing: an error will prevent from compiling it successfully.
- “Each guest gets 2.4 pie(s).”
- “Each guest gets 0.41666666666666666666666…” (it will never ends, displaying 6 forever).
- “Each guest gets 0.416666666666667 pie(s).”
- “Each guest gets 0 pie(s).”
-
Consider the following statement:
Which of the following is correct?
- This program will not compile because the result of
balance - price
is not a decimal. - This program will not compile because a decimal cannot be negative.
- This program will compile.
- This program will not compile because you cannot store an integer value (12) in a decimal.
- This program will not compile because the result of
-
The method used to read a string from the user is called…
-
ReadString
-
ReadFrom
-
ReadLine
-
ReadInput
-
-
Consider the following program:
To correctly be able to store the string in
fromUser
into age, you should replace_______
with…-
(int)
-
int.Parse
- Nothing: as long as the user enters an integer value, we can store it into age just fine.
- None of the above.
-
-
What are, respectively, the return types of a constructor and of a
ToString
method?- Constructors do not have a return type, and a
ToString
method returns astring
. - Constructors and
ToString
methods both returnstring
s. - Constructors returns a
string
, and aToString
method does not return anything (it simply displays a text). - It is impossible to know ahead of time, as this depends of the class they are implemented in.
- Constructors do not have a return type, and a
-
What is the name of a constructor method?
- Nothing: an error will prevent from compiling it successfully.
- Whatever the name of the class is.
- It does not have any.
- The name of the instance it creates.
-
Constructor
-
What are the three logical connectives in C# (that we studied)?
- And (
&&
), or (||
) and negation (!
). - Equality (
==
), greater than (>
) and less than (<
). - And (
and
), or (or
) and negation (not
).
- And (
-
Which of the following will evaluate to true?
-
3 > 1 && 2
-
(3 > 1) && 1 != 0
-
!(3 > 1)
-
3 > 1 || 2
-
-
Will the following expression evaluates, and if so, what will it evaluate to?
evaluates?
- It will evaluate to a number.
- It will evaluate to
false
. - It will evaluate to
true
. - It will not evaluate.
- None of the above.
-
What will be displayed by the following code?
-
12 14 16
-
10 11 12 13 14 15
-
10 11 12 13 14
-
10 12 16
-
10 12
-
10 12 14
-
12+14+16
-
10+11+12+13+14+15
-
-
What will be displayed by the following code?
-
0
followed by a new line, forever. -
0 1 2 3 4 5 6 7 8 9
-
0 1 2 3 4 5 6 7 8 9
with a new line between each number - Nothing
-
-
Consider the following code:
If the user enters “Train”, then it will display:
- returns: False, value: 0
- returns: True, value: 0
- returns: True, value: Train
- returns: False, value: Train
- Nothing: the program will crash.
-
Consider the following code:
What can the user enters to exit this loop:
- There is nothing the user can enter to exit this loop
- Either “Yes” or “yes”
- Anything that is different from “Yes” and “yes”
- Anything
-
Consider the following code:
What can the user enters to exit this loop?
- Any number not between 10 and 100 (both included)
- Any number between 10 and 100 (both included)
- Any number between 10 and 100 (both excluded)
- Any number not between 10 and 100 (both excluded)
-
What will be displayed by the following code?
- -5 0 5 10 15 20
- -5 0 5 10 15
- 0 5 10 15
- -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
- Nothing
- 0 5 10 15 20
-
What will be displayed by the following code?
- 15
- 0
- Nothing
- 1 2 3 4 5