1. Which of the following are legal lines of code? int w = (int)888.8; byte x = (byte)1000L; long y = (byte)100; byte z = (byte)100L;





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    Statements (1), (2), (3), and (4) are correct. (1) is correct because when a floating-point number (a double in this case) is cast to an int, it simply loses the digits after the decimal. (2) and (4) are correct because a long can be cast into a byte. If the long is over 127, it loses its most significant (leftmost) bits. (3) actually works, even though a cast is not necessary, because a long can store a byte.
Show Similar Question And Answers
QA->A train 110ms long passes a telegraph pole in 3 seconds. How long will it take to cross railway platform 165 ms long....
QA->1,87,888 തടാകങ്ങളുള്ള രാജ്യം ? ....
QA->In a certain code SUNDAY is coded as USDNYA. How could CREATION be written in that code?....
QA->.In certain code STUDENT is written as UVWFGPV,how would TEACHER be written in the same code?....
QA->.In a certain code 13479 is written as AGEFT and 5268 as MPNX,How is 369824 written in that code?....
MCQ->Which of the following are legal lines of code? int w = (int)888.8; byte x = (byte)1000L; long y = (byte)100; byte z = (byte)100L;....
MCQ->What will be the output of the program? #include<stdio.h> int fun(int, int); typedef int (pf) (int, int); int proc(pf, int, int); int main() { printf("%d\n", proc(fun, 6, 6)); return 0; } int fun(int a, int b) { return (a==b); } int proc(pf p, int a, int b) { return ((p)(a, b)); }....
MCQ->Which of the following statement is correct about the program given below? #include<iostream.h> int BixTest(int x, int y); int BixTest(int x, int y, int z = 5); int main() { cout<< BixTest(2, 4) << endl; return 0; } int BixTest(int x, int y) { return x y; } int BixTest(int x, int y, int z = 5) { return x y z; }....
MCQ->Which of the following statement is correct about the program given below? #include<iostream.h> static int Result; class India { public: void Change(int x = 10, int y = 20, int z = 30) { cout<< x + y + z; } void Display(int x = 40, float y = 50.00) { Result = x % x; cout<< Result; } }; class Bix { int x, y; public: void Change(int x, int y = 50) { cout<< x + y; } }; class IndiaBix: public India, public Bix { public: void Display(int x = 10, int xx = 100, int xxx = 1000) { Result = x + xx % x x; cout<< Result ; } }; int main() { IndiaBix objBix; objBix.India::Display(10, 20.00); return 0; }....
MCQ->What will be the output of the program? #include<stdio.h> int i; int fun1(int); int fun2(int); int main() { extern int j; int i=3; fun1(i); printf("%d,", i); fun2(i); printf("%d", i); return 0; } int fun1(int j) { printf("%d,", ++j); return 0; } int fun2(int i) { printf("%d,", ++i); return 0; } int j=1;....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution