• HOME
  • QUIZ
  • CONTACT US
EXAMIANS
  • COMPUTER
  • CURRENT AFFAIRS
  • ENGINEERING
    • Chemical Engineering
    • Civil Engineering
    • Computer Engineering
    • Electrical Engineering
    • Mechanical Engineering
  • ENGLISH GRAMMAR
  • GK
  • GUJARATI MCQ

Data Types and Variables

Data Types and Variables
The smallest integer type is ......... and its size is ......... bits.

short, 8
byte, 8
short, 16
short, 16

ANSWER DOWNLOAD EXAMIANS APP

Data Types and Variables
Determine output:class A{ public static void main(String args[]){ int x; x = 10; if(x == 10){ int y = 20; System.out.print("x and y: "+ x + " " + y); y = x*2; } y = 100; System.out.print("x and y: " + x + " " + y); }}

10 20 10 10
10 20 10 20
Error
10 20 10 100

ANSWER DOWNLOAD EXAMIANS APP

Data Types and Variables
Size of int in Java is

16 bit
32 bit
Depends on execution environment
64 bit

ANSWER DOWNLOAD EXAMIANS APP

Data Types and Variables
The following program:public class Test{ static boolean isOK; public static void main(String args[]){ System.out.print(isOK); } }

Prints false
Will not compile as boolean can never be static
Will not compile as boolean is not initialized
Prints true

ANSWER DOWNLOAD EXAMIANS APP

Data Types and Variables
What would be the output of the following fraction of code ?int Integer = 34 ;char String = 'S' ;System.out.print( Integer ) ;System.out.print( String ) ;

Throws exception.
34
Does not compile as Integer and String are API class names.
S
34 S

ANSWER DOWNLOAD EXAMIANS APP

Data Types and Variables
What is the output of the following program?public class Test{static int x = 10 ; public static void main(String[] a){ Test test = new Test( ) ; Test test1 = new Test( ) ; test.x += 1 ; System.out.println( test.x + test1.x ) ; }}

21
Throws Exception
22
Compilation Error
20

ANSWER DOWNLOAD EXAMIANS APP
MORE MCQ ON Data Types and Variables

DOWNLOAD APP

  • APPLE
    from app store
  • ANDROID
    from play store

SEARCH

LOGIN HERE


  • GOOGLE

FIND US

  • 1.70K
    FOLLOW US
  • EXAMIANSSTUDY FOR YOUR DREAMS.
  • SUPPORT :SUPPORT EMAIL ACCOUNT : examians@yahoo.com

OTHER WEBSITES

  • GUJARATI MCQ
  • ACCOUNTIANS

QUICK LINKS

  • HOME
  • QUIZ
  • PRIVACY POLICY
  • DISCLAIMER
  • TERMS & CONDITIONS
  • CONTACT US
↑