Sunday, July 21, 2024

Data types MCQ

 ------------------------

Which of the following is a valid primitive data type in Java?

a) String

b) Array

c) Integer

d) Boolean


What is the size of the 'int' data type in Java?

a) 4 bytes

b) 8 bytes

c) 2 bytes

d) Depends on the platform


Which data type in Java is used to store characters?

a) char

b) character

c) letter

d) string


Which data type is used to store floating-point numbers with double precision in Java?

a) float

b) double

c) decimal

d) real


What is the default value for a boolean variable in Java?

a) true

b) false

c) null

d) 0


Which data type in Java is used to store a single Unicode character?

a) char

b) byte

c) short

d) int


Which data type in Java is used to store numbers with a decimal point?

a) double

b) int

c) long

d) byte


Which of the following is not a valid primitive data type in Java?

a) long

b) double

c) string

d) char


What is the size of the 'long' data type in Java?

a) 2 bytes

b) 4 bytes

c) 8 bytes

d) Depends on the platform


Which data type is used for storing true/false values in Java?

a) boolean

b) bool

c) bit

d) binary


Answers:


a) String

a) 4 bytes

a) char

b) double

b) false

a) char

a) double

c) string

c) 8 bytes

a) boolean


No comments:

Post a Comment

git commands MCQ

 Here are some multiple-choice questions (MCQs) on Git commands relevant for Selenium: 1. Which Git command is used to clone a remote reposi...