Page 148 - ComputerScience_Class_11
P. 148
5. Which of the following is the other name of user-defined data type?
a. Reference data type b. Derived data type
c. Primitive data type d. Both a and b
Answers
1. b 2. c 3. d 4. c 5. d
B. Fill in the blanks.
1. A token is the ………………… unit of the code.
2. There are ………………… different types of literals.
3. ………………… literals represent null value in a string variable.
4. A variable name should start with a ………………… .
5. ………………… is used for the termination of a statement.
Answers
1. fundamental 2. six 3. Null 4. letter 5. Semicolon
C. Answer the following questions:
1. What is the requirement of the wrapper class?
Ans. Wrapper class is required to:
• store the primitive data type in objects.
• convert String to primitive data types and vice versa.
2. What is narrowing?
Ans. The process of assigning a value of a larger data type to a smaller data type using the concept of explicit data conversion is known
as narrowing.
3. What type of conversion does the following program snippet exhibit?
char ch='A';
int n=ch;
Ans. Implicit type conversion
4. What is type conversion?
Ans. The process of changing the value of one type value to another type is known as Type Conversion. It is also known as type
casting.
5. What is a String?
Ans. A string is a sequence of characters stored in a single variable. The characters are written within “ ” (double quotation marks).
6. Explain the different types of literals with the examples.
Ans. There are six different types of literals.
• Integer literals: Integer literals are the whole numbers of any length. They may be positive, negative or zero. For example, 78,
+456, -765, etc.
• Floating-point literals: Floating-point literals are the fractional numbers. They are also called real literals. They may be positive
or negative. For example, 2.65, 985.94, -5.68, etc.
• Character literals: Character literals are the alphabets, numbers or symbols enclosed in single quotes. For example, ‘B’, ‘^’, ‘5’, etc.
• String literals: String literals are a sequence of characters that are enclosed in double quotations. For example, “India”, “Kolkata
700115”, “I am an Indian”, etc.
• Boolean literals: Boolean literals contain two values only: true or false.
• Null literals: Null literals represent the null value in a string variable when we need to initialise it. The default value is ‘null’.
7. What are the rules for naming a variable?
146 Touchpad Computer Science (Ver. 3.0)-XI

