Warm-up Exercises

  1. Explain Boolean type bool and the meaning of logical operations AND (&&), OR (||) and negation (!). Provide a small example.

  2. Declare a variable of type int, with value 3.​

Questions

  1. Write a statement that initializes a variable named myHeightInMeters to your height in meters. What should be the datatype of myHeightInMeters, and why?

  2. What is wrong with the following? Will the error(s) appear at compilation time, or at execution time?

int age;
Console.WriteLine("Please enter your age:");
age = Console.ReadLine();
  1. What is the difference, if any, between 3 and “3”?

Problems

  1. Declare and initialize 3 variables:
  2. Each variable should have a different data type
  3. Choose an appropriate name and value for each variable Then display the value of each variable on the screen.

collections strings numerical