1st PUC Computer Science Question Bank Chapter 8 Data Types

You can Download Chapter 8 Data Types Questions and Answers, Notes, 1st PUC Computer Science Question Bank with Answers Karnataka State Board Solutions help you to revise complete Syllabus and score more marks in your examinations.

Karnataka 1st PUC Computer Science Question Bank Chapter 8 Data Types

1st PUC Computer Science Data Types One Mark Questions and Answers

Question 1.
What is meant by data types?
Answer:
The set of values along with the operations that can be performed on these values are called as data types.

Question 2.
Give the classification of data types.
Answer:
Data types are classified into built-in or basic data types and user-defined or derived data types.

KSEEB Solutions

Question 3.
Name the built-in data types of C++.
Answer:
The built-in or basic data types supported by C++ are integer, floating-point, and character types.

Question 4.
How is derived data type created?
Answer:
The derived data type is created by using basic data types.

Question 5.
What is linear data structure?
Answer:
When data elements are arranged in a sequential manner it is called as linear data structure.

Question 6.
What is a non-linear data structure?
Answer:
When the data elements are arranged non-sequentially it is called as non linear data structure.

Question 7.
Give the range of values that int data type can store.
Answer:
The range of values that int data type can store is from -32768 to 32767.

Question 8.
Give the ‘char’ data type range of values.
Answer:
The ‘char’ can store 256 characters in the range of-128 to 127.

KSEEB Solutions

Question 9.
Give the storage size of the float data type.
Answer:
The float data type needs 4 bytes of memory for each number with a fractional part.

Question 10.
Define modifiers.
Answer:
The modifiers change the meanings of the predefined built-in data types and expand them to a much larger set.

Question 11.
Write the different modifiers.
Answer:
The different modifiers are long, short, signed and unsigned.

Question 12.
What is the range of values that unsigned int can store?
Answer:
The range of values that unsigned int stores is 0 to 65535.

Question 13.
Give the unsigned char range of values.
Answer:
The unsigned char can store the value in the range of 0 to 255.

KSEEB Solutions

Question 14.
Mention a few user-defined data types.
Answer:
A few user-defined data types are structure, union, class and enumerated data types.

Question 15.
What is an enumerated data type?
Answer:
An enumerated type is a data type where every possible value is defined as a symbolic constant (called an enumerator).

1st PUC Computer Science Data Types Two/Three Marks Questions and Answers

Question 1.
What are the variables? Give an example.
Answer:
It is a location in the computer memory which can store data and is given a symbolic name for easy reference.
For example, Total = 20.00; In this statement, a value 20.00 has been stored in a memory location Total.

Question 2.
Give the declaration syntax of a variable and example.
Answer:
The syntax for declaring a variable is

  1. datatype variablename;
  2.  example, on

Question 3.
variable initialized? Give an example.
Answer:
The variable is initialized during declaration of the variable with initial value.
For example, int a = 20;

KSEEB Solutions

Question 4.
Explain lvalue and rvalue. Give a examples.
Answer:
Lvalue is the location value and r value is the data value of a variable.
int age =16;
lvalue is the location value of age and 16 is the r-value.

Question 5.
What is dynamic initialization? Give its advantage.
Answer:
It is a method of initialization C++ adopts. In this method, C++ declares a variable during the run time of the program. The advantage is variables can be initialized anywhere in the program before they are used.

Question 6.
Write the features of int data type.
Answer:
Integers are those values which have no decimal part and they can be positive or negative, like 12 or-12.

  1. int keyword is used for integers.
  2. It takes two bytes in memory.

There are two more types of int data type

  1. signed int or short int
  2. unsigned int or unsigned short int.

Question 7.
Give the features of char data type.
Answer:
C++ offers a predefined data type that is one byte in size, which can hold exactly one character such as ‘a’ or ‘A’.
To declare a variable of type char,
char ch;

Question 8.
Write the features of the float data type.
Answer:
C++ defines the type float data as representing numbers that have a fractional part. For example, 12.55. Floating-point variables can either be small or large. A variable with float type occupies 4 bytes in size and can hold numbers from 10-308 to 10+308 with about 15 digits of precision. There is a long double, also available, that can hold numbers from 10-4932 to 10+4932.

KSEEB Solutions

Question 9.
What is a void? Give the usage.
Answer:
The data type void has no values and no operations means it is empty. It plays the role of generic data type and can represent any of the other standard types. It is also used in functions which do not return any value.

Question 10.
Explain bool data type.
Answer:
The bool data type means Boolean, that has the logical value true or false. It can be used to manipulate logical expressions.

Question 11.
What is named constant? Give the declaration.
Answer:
The named constant is a memory location, whose value cannot be changed during the execution of a program.
Declaration syntax:
const datatype variable = initial value;

Question 12.
What are the conversion rules for enum type?
Answer:
There is an implicit conversion from any enum type to int. It does not support for implicit conversion from into to enum type.

1st PUC Computer Science Data Types Five Marks Questions and Answers

Question 1.
Write a short note on variables.
Answer:
“A variable is a temporary container to store information, it is a named location in computer memory where varying data, like numbers and characters, can be stored and manipulated during the execution of the program”.
A variable must be declared before it is used.
For example, int my_age;
A few naming conventions must be taken in consideration.

  1. It must start with an english alphabet character, either lowercase or uppercase, including underscore (not a hyphen). It may not start with a digit. The rest is optional. It can either be a letter or a digit (0-9).
  2. C++ keywords like main, case, class, if, else, do, while, for, tyedef, etc cannot be used as a variable names.
  3. It must be unique within the scope.

KSEEB Solutions

Question 2.
Explain the basic data types in details.
Answer:
In computer programming, information is stored in a computer memory with different data types. We must know what is to be stored in a computer memory, whether it is a simple number, a letter or a very large number.
Basic Data types in C++
1. character:
C++ offers a predefined data type that is one byte in size, which can hold exactly one character such as ‘a’ or ‘A’. To declare a variable of type char, we have
char ch;
Suppose we want to store a character value ‘a’, in a char data type eh, it is enclosed within a single quote.
ch = ‘a’;
Only a single character can be stored in a variable of type char.

2. integer:
On most machines, the size of int type is 2 bytes. C++ defines this type as consisting of the values ranging from -32768 to 32767. This range is for the small integer. If a long integer is needed, the type long or long int can be used. The range of long int is too big that is from -2147483648 to 2147483647, which occupies 4 bytes in memory.

3. float:
C++ defines the data type float, as representing numbers that have a fractional part. For example, 12.55 as opposed to integers which have no fractional part. Floating-point variables can either be small or large. A variable with type float occupies 4 bytes in size and can hold numbers from 10-308 to 10+308 with about 15 digits of precision. There is a long double, also available, that can hold numbers from 10-4932 to 10+4932.

4. Bool:
It is an additional data type for representing a Boolean value. A variable associated with a bool data type may be assigned an integer value 1 to the literal true and a value 0 to the literal false.

Question 3.
Write a short note on modifiers.
Answer:
C++ allows the char, int, and double data types to have modifiers preceding them. A modifier is used to alter the meaning of the base type so that it more accurately fits the needs of various situations.
The data type modifiers are listed here:

  1. signed
  2. unsigned
  3. long
  4. short

The modifiers signed, unsigned, long and short can be applied to integer base types. In addition, signed and unsigned can be applied to char, and long can be applied to double. The modifiers signed and unsigned can also be used as prefix to long or short modifiers. For example, unsigned long int.

C++ allows a shorthand notation for declaring unsigned, short, or long integers. You can simply use the word unsigned, short or long, without the int. The int is implied. For example, the following two statements both declare unsigned integer variables, unsigned x; unsigned int y;

KSEEB Solutions

Question 4.
Write the different data types, memory size in bytes, minimum value, maximum value
Answer:
Data types in C++
1st PUC Computer Science Data Types Five Marks Questions and Answers 1

Leave a Comment