Beruflich Dokumente
Kultur Dokumente
((x < 10) && ( x > 5)) || ((x > 20) && (x <
25));
System.Convert.ToInt32("35");
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
2. What methods are used for displaying text/output on screen which is considered are C# console output
statements? What are the differences between these methods?
Printing String using WriteLine()
Console.WriteLine("Prints on "); The main difference
Console.WriteLine("New line"); between WriteLine() and Write() is that
Output: the Write() method only prints the string provided
Prints on to it, while the WriteLine() method prints the string
New line and moves to the start of next line as well.
Printing String using Write()
Console.Write("Prints on ");
Console.Write("Same line");
Output:
Prints on Same line
3. What are the console input statements in C# which are used for capturing input from users? Discuss the
differences of each method.
Console.WriteLine() statement, Console.ReadLine() statement Console.ReadKey() statement
we display the message on the will read our input, but it is of is here just to keep our console
console window and move to the type string and what we need is window open.
next line. an int type.
So, we need to convert it with
the Convert. To
Int32() statement.
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
The rulesRepublic
to be followed
of thewhile using an identifier include:
Philippines
It can start only with a letterSTATE
MARINDUQUE of the alphabet
COLLEGE or underscore(_), but not a number
It can be SCHOOL
a combination of numbers, letters, connectors, Unicode escape sequence, etc.
OF TECHNOLOGY
It cannotP.beManguera
a C# keyword
Sr., Rd.
It shouldTanza,
not contain
Boac,white space
Marinduque
It cannot have more than 511 characters
It has to be declared before it is referred
It cannot have two consecutive underscores in its name because such identifiers are used for the
implementation
More than one identifier with the same name cannot be declared within a single scope
An identifier prefixed with "@" is called a verbatim identifier. Although prefixing "@" allows
for the use of keywords, which helps in interfacing with other programming languages, it is not a
recommended practice.
C# has a total of 79 keywords. All these keywords are in lowercase. Here is a complete list of all C#
keywords.
abstract as base bool
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
static Republic
string of the Philippines
struct switch
MARINDUQUE STATE COLLEGE
this SCHOOL
throw OF TECHNOLOGY
true try
P. Manguera Sr., Rd.
typeof Tanza,
uint Boac, Marinduque ulong unchecked
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
8. What are the two kinds of C# type conversion? Provide programming example.
Type Conversion Description Example Conversion
Implicit type conversion These conversions are performed // Implicit conversion. A
by C# in a type-safe manner. For long can
example, are conversions from // hold any value an int can
smaller to larger integral types hold, and more!
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
namespace TypeConversionApplication {
class StringConversion {
static void Main(string[] args) {
int i = 75;
float f = 53.005f;
double d = 2345.7652;
bool b = true;
Console.WriteLine(i.ToString());
Console.WriteLine(f.ToString());
Console.WriteLine(d.ToString());
Console.WriteLine(b.ToString());
Console.ReadKey();
}
}
}
Output:
75
53.005
2345.7652
True
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018
Republic of the Philippines Courses Offered:
MARINDUQUE STATE COLLEGE
SCHOOL OF TECHNOLOGY BS Industrial Technology
P. Manguera Sr., Rd. BS Information Technology
BS Information System
Tanza, Boac, Marinduque
Prepared By:
VISION: “Marinduque State College is a research-driven higher education institution pursuing excellence and innovation by 2025.”
MISSION: “Marinduque State College is committed to pursue progressive and innovative lifelong education founded on humanistic, professional and technologically
advanced programs across cultures and communities by establishing centres’ of excellence and development and research-driven outreach programs.”
Revision No: 0
Revised Date: 08/05/2018