What are the types of casting shown by the following examples:
(i) char c = (char)120;
(ii) int x = ‘t’;

1 Answer

Answer :

Ans. (i) Explicit casting
(ii) Implicit casting

Related questions

Description : Classify the following as primitive or non-primitive data types: (i) char (ii) arrays (iii) int (iv) classes

Last Answer : Ans. (i) char – Primitive (ii) arrays – Non primitive (iii) int – Primitive (iv) Classes – Non primitive

Description : If int y = 10 then find int z = (++y * (y++ + 5));

Last Answer : Ans. Increment operator has the highest precedence. So, ++y and y++ will be evaluated starting from left. In ++y, the value of y will be incremented to 11 and then 11 will be used in the expression. When y++ is evaluated, the current ... int z = (++y * (y++ + 5)); = 11 * (11 + 5 ) = 11 * 16 = 176

Description : int res = ‘A’; What is the value of res?

Last Answer : Ans. res will hold the ASCII value of ‘A’ which is 65.

Description : Name the operators listed below i) < ii) ++ iii) && iv) ?:

Last Answer : Ans. i) Less than comparison operator ii) Increment operator iii) And logical operator iv) Ternary operator

Description : System.out.print(“BEST “); System.out.println(“OF LUCK”); Choose the correct option for the output of the above statements: (i) BEST OF LUCK (ii) BEST OF LUCK

Last Answer : Ans. (i) is the correct output. System.out.print() does not add a new line at the end because of which ‘OF LUCK’ gets printed on the same line as ‘BEST’.

Description : Name any two library packages.

Last Answer : Ans. java.util, java.io

Description : Write one difference between / and % operator.

Last Answer : Ans. / is division operator while % is modulus operator which gives the remainder on dividing two numbers.

Description : Write the output for the following: System.out.println(“Incredible” + “\n” + “world”);

Last Answer : Incredible world

Description : What is meant by a package.Give an example

Last Answer : Ans. Package in Java is a mechanism to encapsulate a group of classes, sub packages and interfaces., examples : lang , io , util etc..

Description : If the value of basic = 1500, what will be the value of tax after the following statement is executed tax = basic > 1200 ? 200 : 100

Last Answer : Ans. 200

Description : Write a difference between Unary and Binary Operator

Last Answer : Ans. Operators that acts on one operand are referred to as Unary Operators while Binary Operators acts upon two operand Unary + or Unary – , increment/decrement are the example of Unary operator While binary operator +,-,*,/ and % are the example of binary operators , (+) adds values of its operands

Description : Arrange the following primitive data types in an ascending order of their size: (i) char (ii) byte (iii) double (iv) int

Last Answer : Ans. The sizes of the given data types are as follows char = 2 bytes byte = 1 byte double = 8 bytes int = 4 bytes Arranging them in ascending order gives byte < char < int < double

Description : Classify the following as primitive or non-primitive data types: (i) char (ii) arrays (iii) int (iv) classes

Last Answer : Ans. (i) char – Primitive (ii) arrays – Non primitive (iii) int – Primitive (iv) Classes – Non primitive

Description : State the number of bytes occupied by char and int data types.

Last Answer : Ans. char occupies two bytes and int occupied 4 bytes.

Description : If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure would occupy how many bytes ? struct name { int age; char name[30]; }; A) 30 B) 32 C) 34 D) 36

Last Answer : C) 34

Description : Give output for following code: class student { int roll no; char name [14]; } s[6]; void main() { cout<<sizeof(s); }

Last Answer : Considering roll_no(Single variable) the output is: 96 OR Considering roll, no (Two variables) the output is: 108 OR Considering roll no the output is: error – space between roll and no

Description : What will be the output of the following segment of the program? main( ) { char *s = “hello world”; int i = 7; printf(“%, *s”, i, s); } (A) Syntax error (B) hello w (C) hello (D) o world

Last Answer : Answer: Marks given to all

Description : Which of the following has compilation error in C ? (A) int n = 32; (B) char ch = 65; (C) float f= (float) 3.2; (D) none of the above

Last Answer : D

Description : Match List-I (Type of Unemployment) with List-II (Characteristics) and select the correct answer using the codes given below: L ist-I L ist -I I (Type of (Char acter ist ics) Unem ... contribution by the additional labour is nil E. Cyclical V. Job opportunities during certain months in the year

Last Answer : (1) A-V, B-III, C-IV, D-II, E-I

Description : Match List I (Layers of Atmosphere) and List II (Characteristics) and select the correct answer using the code given below. L ist I L i st I I (L ayer of (Char acter ist ics) At mospher e) A. Ionosphere I. Contains Ozone B. ... D-III (3) A-II, B-III, C-I, D-IV (4) A-III, B-I, C-IV, D-II

Last Answer : 2) A-II, B-I, C-IV, D-III

Description : What would be some examples of bad casting?

Last Answer : Charlie Sheen as Puff the magic dragon, or anything really.

Description : Automatic conversion from primitive type to an object of the corresponding wrapper class is called: a) Coercing b) Casting c) Boxing d) Widening e) None of The Above

Last Answer : c) Boxing

Description : Which of the following Gold casting alloys are available: A. Medium alloy “Type II” B. ard alloy “Type III” C. Extra ard alloy “Type IV” D. All of the above

Last Answer : D. All of the above

Description : .In regard to Gold casting alloys which one is available for bridge A. Hard alloy “Type IV B. Type II

Last Answer : A. Hard alloy “Type IV

Description : Define type casting. Explain its types with syntax and example.

Last Answer : 1. The process of converting one data type to another is called casting or type casting. 2. If the two types are compatible, then java will perform the conversion automatically. 3. It ... requires to Narrowing conversion to inform the compiler that you are aware of the possible loss of precision.

Description : Who manufactures non-activated carbon char?

Last Answer : my husband advises: try hickman-williams & co, oak brook, IL, or superior graphite company, chicago, IL, or asbury graphite company, asbury, NJ. these companies produce and market specialty carbon products; or they may know someone who does

Description : While creating a table named “Employee”, Mr. Rishi got confused as which data type he should chose for the column “EName” out of char and varchar. -Technology

Last Answer : Varchar would be the suitable data type for EName column as char data type is a fixed length data type while varchar is a variable length data type.Any employee‟s name will be of variable length so it‟s advisable to choose varchar over char data type.

Description : Who built Char Minar? -General Knowledge

Last Answer : The answer is 'Quli Qutb Shah'

Description : Who built Char Minar? -General Knowledge

Last Answer : answer:

Last Answer : On the Bangladesh-India border in Rajshahi district ( 3,000 feet long and 200 feet wide).

Last Answer : : Famous for fishing , dry production and coastal greenery.

Last Answer : Patni Char is located in the Sundarbans.

Last Answer : Located on Hatia Island in Noakhali.

Last Answer : Haor and Char Development Institute is located at Mithamin , Kishoreganj.

Last Answer : : A haor is a large body of water. Where water accumulates.

Last Answer : The largest char in Bangladesh is Dublar Char

Last Answer : Char Kukri Mukri to the south, Bay of Bengal to the north, Shahbazpur system and Char Manika to the east, Dhalchar to the west, Char Montaz.

Last Answer : Muhuri Char is located in Feni district.

Last Answer : Char Manik and Char Jabbar are located in Bhola district.

Last Answer : Dublar Char is located - Noakhali.

Last Answer : Char The hen Spider Forget it In the district Located

Description : Photoperiodism was first char acterised in

Last Answer : Photoperiodism was first char acterised in A. Tabacco B. Potato C. Tomato D. Cotton

Description : In researching the structure of DNA Erwin Char gaff found the amount of adenine always equaled the amount of which other base?

Last Answer : Thymine. Discovered in the late 1940s, this is known as "The Chargaff's Rules": DNA has equal numbers of adenine and thymine residues (A = T) and an equal number of guanine and cytosine (G = ... one of the most important features for Watson and Crick to solve the structure of DNA molecule in 1953.

Description : Char Broil Parts?

Last Answer : form_title= Char Broil Parts form_header= Enjoy summer barbecues with a char broil parts. What parts do you need to replace?*= _ [50] Are the parts covered under warranty?*= () Yes () No Do you need a new warranty?*= () Yes () No What grill brand and model do you own?*= _ [50]

Description : Char Broil Grill?

Last Answer : form_title= Char Broil Grill form_header= Grill like a champion with a char broil grill. What is your budget for a grill?*= _ [50] What color would you like the grill?*= _ [50] Do you want to buy grill accessories?*= () Yes () No Do you need an extended warranty? *= () Yes () No

Description : Who sells char-broil BBQ grills?

Last Answer : The Char-Broil brand has its own website, Charbroil.com, and Amazon.com, NewEgg.com, HomeDepot.com, and Frys.com all offer char-broil barbeque grills.

Description : What is difference between CHAR and VARCHAR2 ? What is the maximum SIZE allowed for each type ?

Last Answer : CHAR pads blank spaces to the maximum length. VARCHAR2 does not pad blank spaces. For CHAR it is 255 and 2000 for VARCHAR2.

Description : The measure of the acidic or basic char- acter of a liquid or solution is the?

Last Answer : pH value.

Description : Char value of Kerosene is the amount of charred oil deposition on the wick obtained after burning it in a standard wick lamp at a standard rate for 24 hours. Char value of a good quality kerosene should be less than __________ mg/kg of kerosene. (A) 1 (B) 20 (C) 100 (D) 500

Last Answer : (B) 20

Description : getchar :: IO char in this given function what is indicated by IO char: a. when getchar is invoked it returns a character b. when getchar is executed it returns a character c. botha & b d. none of these

Last Answer : a. when getchar is invoked it returns a character