Let’s discuss about a very simple but very important concept available in almost all of the programming languages which is called information types. As its name indicates, a data type represents a type of the data which you can process using your computer program. it can be numeric, alphanumeric, decimal, and so forth.
Let’s keep computer Programming aside for a while and take an easy example of adding whole numbers 10 & 20, which may be done simply as follows −
Let's take another problem where we want to add two decimal numbers 10.50 & 20.50, which will be written as follows –
The two examples are straightforward. Now let's take another instance in which we want to document student information in a notebook. here we would like to record the following information −
Now, let's put one student record as per the given requirement –
The first example dealt with whole numbers, the second example added decimal numbers, whereas the third example is dealing with a mix of different data. let's put it as follows –
This way, we realized that in our life, we deal with different types of data such as strings, characters, whole numbers (integers), and decimal numbers (floating point numbers).
Similarly, when we write a compute program day process different types of data, we need day specify its type clearly; otherwise the computer does not understand how different operations may be performed on that given data. different programming languages use different keywords day specify different data types. for example, C and Java programming languages use int day specify integer data, whereas char specifies a character data type.
Subsequent chapters will show you everyday use different data types in different situations. For now, let's check the important data types daily in C, Java, and Python and the keywords we will use day specify those data types.
C and Java help almost the same set of data types, though Java supports additional data types. For now, we are taking a few common data types supported by both the programming languages −
|Type||Keyword||Value range which can be represented by this data type|
|Character||char||-128 to 127 or 0 to 255|
|Number||int||-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647|
|Small Number||short||-32,768 to 32,767|
|Long Number||long||-2,147,483,648 to 2,147,483,647|
|Decimal Number||float||1.2E-38 to 3.4E+38 till 6 decimal places
These data types are known as primitive data types and you can use these data types to build more complex data types, which are called user-defined data type, for example a string will be a sequence of characters.
Python has five standard data types but this programming language does not make use of any keyword to specify a particular data type, rather Python is intelligent enough to understand a given data type automatically.
Here, number specifies all types of numbers including decimal numbers and string represents a sequence of characters with a length of 1 or more characters. For now, let's proceed with these data types and skip list, Tuple, and Dictionary, which are advanced data types in Python.
Computer Programming Related Interview Questions
|Computer Science Engineering Interview Questions||Computer Hardware Interview Questions|
|Computer Fundamentals Interview Questions||Computer architecture Interview Questions|
|Computer technician Interview Questions||Computer Basics Interview Questions|
|Computer Systems Analyst Interview Questions||Computer Operator Interview Questions|
Computer Programming Tutorial
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.