0% found this document useful (0 votes)
3 views3 pages

Basicsofjava MCQ

java questions

Uploaded by

sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Basicsofjava MCQ

java questions

Uploaded by

sri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

{

"What is the primary function of a computer?":


"To perform calculations": false,
"Marked To store and process data": true,
"To create documents": false,
"To browse the internet": false
"Which of the following is a system software?":
"Microsoft Word": false,
"Marked Windows OS": true,
"Adobe Photoshop": false,
"Google Chrome": false
"Which part of the computer is responsible for executing instructions?":
"Monitor": false,
"Keyboard": false,
"Marked CPU": true,
"Mouse": false
"What is the difference between RAM and ROM?":
"Marked RAM is volatile, and ROM is non-volatile": true,
"ROM is faster than RAM": false,
"RAM stores permanent data, while ROM stores temporary data": false,
"ROM is used for processing data, while RAM is used for storing data":
false
"What does CPU stand for?":
"Marked Central Processing Unit": true,
"Central Programming Unit": false,
"Computer Processing Unit": false,
"Central Performance Unit": false
"What will be the value of x after the following operation? int x = 5; x++;":
"4": false,
"5": false,
"Marked 6": true,
"7": false
"Which field in an email should you use to send a copy of an email to someone
without revealing the recipients to each other?":
"To": false,
"CC": false,
"Marked BCC": true,
"Subject": false
"Which of the following is an example of a programming language?":
"HTML": false,
"JavaScript": false,
"SQL": false,
"Marked All of the above": true
"What is the correct way to start the main method in Java?":
"Marked public static void main(String[] args)": true,
"void main(String args)": false,
"public static main(String[] args)": false,
"public void main()": false
"Which of the following is a compiled language?":
"JavaScript": false,
"Python": false,
"Marked Java": true,
"HTML": false
"Which of the following is a primitive data type in Java?":
"String": false,
"Array": false,
"Marked int": true,
"List": false
"What is the result of the expression 5 + 2 * 3 in Java?":
"21": false,
"Marked 11": true,
"15": false,
"13": false
"Which of the following is true about a while loop?":
"The loop will always execute at least once.": false,
"Marked The loop may never execute if the condition is false initially":
true,
"It always iterates a fixed number of times.": false,
"It does not need a condition to run.": false
"How do you read a line of input from the user in Java?":
"Marked System.console().readLine()": true,
"System.in.read()": false,
"Scanner.nextInt()": false,
"System.out.read()": false
"What is the role of the JVM in Java?":
"To compile Java code to bytecode": false,
"Marked To run the compiled bytecode": true,
"To provide development tools for Java": false,
"To optimize code at runtime": false
"Which access modifier in Java allows visibility to all classes regardless of
the package?":
"private": false,
"protected": false,
"default": false,
"Marked public": true
"What is true about a constructor in Java?":
"A constructor must have a return type.": false,
"Marked A constructor is called when an object is created": true,
"A constructor can be called manually.": false,
"A class can only have one constructor.": false
"Which method acts like a destructor in Java?":
"Marked finalize()": true,
"destroy()": false,
"close()": false,
"None of the above": false
"Which of the following is not a principle of Object-Oriented Programming?":
"Encapsulation": false,
"Polymorphism": false,
"Inheritance": false
"Marked Compilation": true,
"How do you declare an array of integers in Java?":
"int[] arr;": false,
"int arr[];": false,
"int arr[5];": false,
"Marked All of the above":true
"Which of the following is a correct comment in Java?":
"Marked // This is a comment": false,
"Marked /* This is a comment */": false,
"** This is a comment **": false,
"Marked Both A&B":true
"What is the extension of a compiled Java file?":
".java": false,
"Marked .class": true,
".exe": false,
".bin": false
"Which of the following is the correct way to declare a variable in Java?":
"Marked int x = 10;": true,
"var x = 10;": false,
"x = 10;": false,
"int x : 10;": false
"What is the entry point of a Java application?":
"public static void start(String[] args)": false,
"Marked public static void main(String[] args)": true,
"public void main(String args)": false,
"public static start(String args)": false
"Which keyword is used to create an object in Java?":
"create": false,
"Marked new": true,
"instance": false,
"object": false
"Which of the following keywords is used to terminate a loop in Java?":
"Marked break": true,
"continue": false,
"return": false,
"stop": false
"What is the output of the following code snippet? int i = 0; while (i < 5)
{ i++; }":
"4": false,
"Marked 5": true,
"6": false,
"0": false
"Which operator is used to concatenate two strings in Java?":
"Marked +": true,
"&": false,
"&&": false,
"||": false
"What is the result of the expression 5 % 2 in Java?":
"0": false,
"Marked 1": true,
"2": false,
"5": false
"Which datatype would you use to store a true/false value?":
"int": false,
"char": false,
"Marked boolean": true,
"byte": false
"Which operator is used to compare two values for equality in Java?":
"Marked ==":true,
"=": false,
"!=": false,
">": false
}

You might also like