Welcome Guest | Sign in | Register

Home > C Programming > Typecasting > Questions and Answers

Exercise:

Section 1

01. Which header file do you need to include to use typecasting? 
A. stdin.h B. ctype.h
C. math.h D. None

Answer and Explanation

Answer: None

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
02. Which is a valid typecast?
A. a(char); B. char:a;
C. (char)a; D. to(char, a);

Answer and Explanation

Answer: (char)a;

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
03. Why can typecasting be dangerous?
A. Some conversions are not defined, such as char to int. B. You might permanently change the value of the variable.
C. You might temporarily lose part of the data - such as truncating a float when typecasting to an int. D. There are no dangers.

Answer and Explanation

Answer: You might temporarily lose part of the data - such as truncating a float when typecasting to an int.

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
04. Which is a good use for typecasting?
A. To allow division of two integers to return a decimal value. B. To allow your program to use nothing but integers.
C. To change the return type of a function. D. To swap variables rapidly.

Answer and Explanation

Answer: To allow division of two integers to return a decimal value.

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
05. Which conversion is not possible?
A. int to float B. float to int
C. char to float D. All are possible

Answer and Explanation

Answer: All are possible

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
06. Which of the following program structure/component/statement is not an example for implementation of modularization ? 
A. DLL B. Functions
C. type casting D. pointers

Answer and Explanation

Answer: type casting

Explanation:
Option c) type casting. DLL and Functions help in modularization of a program while typecasting just converts from one data type to another.

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
07. What is the output of following program?
void main(){
int a;
a=100;
printf("%d%d",++a,a++);
}   
A. 101 101 B. 101 102
C. 102 100 D. 102 101

Answer and Explanation

Answer: 102 100

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
08. What is the output of following program?
void abc(int a, int b){
printf("%d%d",++a,++b);
}
void main(){
int a=10;
abc(++a,a++);
abc(a++,++a);
printf("%d",a);
}
A. 13 12 12 13 14 B. 13 11 14 14 14
C. 13 11 13 14 14 D. 13 12 14 14 14

Answer and Explanation

Answer: 13 11 14 14 14

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum
09. What is the mean of type casting?                    
A. Conversion of the Data item B. Conversion of variables
C. fixed the value of Data item D. none

Answer and Explanation

Answer: Conversion of the Data item

Explanation:
There is no explanation...

Report Errors

Name:

Loading...

VView Answer | RReport | DDiscuss in Forum



Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.