Java MCQs - 9
What is the output of the following code? String str = "Java"; str.concat(" Programming"); System.out.println(str); ...
What is the output of the following code? String str = "Java"; str.concat(" Programming"); System.out.println(str); ...
What does the this keyword refer to in Java? A) It refers to the previous object. B) It refers to the next object. C) It refers to the curre...
What is the output of the following code? String str = "Hello, World!"; System.out.println(str.indexOf("o")); A) 5...
What is the output of the following code? int[][] arr = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; System.out.println(arr[1][2]); A)...
What is the output of the following code? String str = "Hello, World!"; System.out.println(str.substring(7)); A) World! B...
What is the output of the following code? int x = 5; int y = 2; System.out.println(x / y); A) 2.5 B) 2 C) 2.0 D) 2.5 wit...
What is the output of the following code? int x = 10; System.out.println(x++); A) 10 B) 11 C) 9 D) Compiler error Answer: A) 10 ...
Which keyword is used to specify that a method does not return any value in Java? A) void B) null C) none D) empty Answer: A) void ...
Which of the following is true about Java? A) Java is a low-level programming language. B) Java is a purely procedural language. C) Java i...
What is the purpose of the res.type() method in Express.js? A) To set the HTTP status code of the response B) To set the content type...
Which of the following Express.js methods is used to handle HTTP OPTIONS requests? A) app.options() B) app.get() C) app.post() ...
Which of the following is NOT a built-in middleware function in Express.js? A) express.json() B) express.static() C) express.urlen...
What is the purpose of the req.query object in Express.js? A) To access request query parameters B) To access request headers C) T...
In Express.js, what is the purpose of the res.redirect() method? A) To send an HTTP response with JSON data B) To send an HTTP respon...
Which of the following modules is commonly used for authentication in Node.js web applications? A) express-session B) http C) fs ...
Which of the following modules is commonly used for routing in Node.js web applications? A) http B) fs C) express D) os ...
What is the purpose of the npm install command in Node.js? A) To initialize a new Node.js project B) To install dependencies for a No...
What is the purpose of the Buffer class in Node.js? A) To manipulate binary data B) To manage HTTP requests C) To handle file syst...
What is Node.js? A) A JavaScript runtime built on Chrome's V8 JavaScript engine B) A front-end framework for building user interf...
What is the output of the following code snippet? $x = 10; $y = 3; echo $x % $y; A) 3 B) 1 C) 0 D) 2 Answer: ...