Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
01. Choose the most appropiate type
02. Values assigned to float and double
03. Comparison between float numbers
04. Integer in Hexadecimal format
05. Character with Unicode code 72
06. IsFemale
07. Type casting test
08. Quoted strings - escaping test
09. Isosceles symbol triangle
10. Records of firm's employees
11. Swapping values of two variables
12. ASCII table
13. Tests with null values
14. A bank account
02. Primitive Data Types and Variables.sln
02. Primitive Data Types and Variables.zip
Primitive-Data-Types-and-Variables.pptx
Readme.md

Readme.md

Primitive Data Types and Variables

  1. Declare five variables choosing for each of them the most appropriate of the types byte, sbyte, short, ushort, int, uint, long, ulong to represent the following values: 52130, -115, 4825932, 97, -10000.
  • Which of the following values can be assigned to a variable of type float and which to a variable of type double: 34.567839023, 12.345, 8923.1234857, 3456.091?

  • Write a program that safely compares floating-point numbers with precision of 0.000001. Example: (5.3 ; 6.01) -> false; (5.00000001 ; 5.00000003) -> true

  • Declare an integer variable and assign it with the value 254 in hexadecimal format. Use Windows Calculator to find its hexadecimal representation.

  • Declare a character variable and assign it with the symbol that has Unicode code 72. Hint: first use the Windows Calculator to find the hexadecimal representation of 72.

  • Declare a boolean variable called isFemale and assign an appropriate value corresponding to your gender.

  • Declare two string variables and assign them with "Hello" and "World". Declare an object variable and assign it with the concatenation of the first two variables (mind adding an interval). Declare a third string variable and initialize it with the value of the object variable (you should perform type casting).

  • Declare two string variables and assign them with following value:

    The "use" of quotations causes difficulties.

    Do the above in two different ways: with and without using quoted strings.

  • Write a program that prints an isosceles triangle of 9 copyright symbols ©. Use Windows Character Map to find the Unicode code of the © symbol. Note: the © symbol may be displayed incorrectly.

  • A marketing firm wants to keep record of its employees. Each record would have the following characteristics – first name, family name, age, gender (m or f), ID number, unique employee number (27560000 to 27569999). Declare the variables needed to keep the information for a single employee using appropriate data types and descriptive names.

  • Declare two integer variables and assign them with 5 and 10 and after that exchange their values.

  • Find online more information about ASCII (American Standard Code for Information Interchange) and write a program that prints the entire ASCII table of characters on the console.

  • Create a program that assigns null values to an integer and to double variables. Try to print them on the console, try to add some values or the null literal to them and see the result.

  • A bank account has a holder name (first name, middle name and last name), available amount of money (balance), bank name, IBAN, BIC code and 3 credit card numbers associated with the account. Declare the variables needed to keep the information for a single bank account using the appropriate data types and descriptive names.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.