Doubtly
@Doubtly · Joined Feb 2021
- Answers
- 3,792
- Questions
- 4,033
- Upvotes received
- 427
- Which of these are selection statements in Java? a) break b) continue c) for() d) if() Answer: d Explanation: Continue and break are jump statements, and for is a looping statement. 1
- What will be the output of the following Java program? Answer: c c) 256 0 2
- Which of the following is a type of polymorphism in Java Programming? Answer: b Explanation: There are two types of polymorphism in Java. Compile time polymorphism (overloading) and runtime polymorphism (overri... 1
- What will be the error in the following Java code? byte b = 50; b = b * 50; a) b cannot contain value 50 Answer: d Explanation: While evaluating an expression containing int, bytes or shorts, the whole expression is converted to int then evaluat... 1
- What will be the output of the following Java program? Answer: a Explanation: Second print statement doesn’t have access to y , scope y was limited to the block defined after initialization of x. 1
- What is not the use of “this” keyword in Java? Answer: b Explanation: “this” is an important keyword in java. It helps to distinguish between local variable and variables passed in the me... 1
- Which of the following is not an OOPS concept in Java? a) Polymorphism b) Inheritance c) Compilation d) Encapsulation Answer: c Explanation: There are 4 OOPS concepts in Java. Inheritance, Encapsulation, Polymorphism and Abstraction. 1
- What will be the output of the following Java program? a) NaN b) Infinity c) 0.0 d) all of the mentioned Answer: d Explanation: For floating point literals, we have constant value to represent (10/0.0) infinity either positive or negative and al... 1
- Which environment variable is used to set the java path? a) MAVEN_Path b) JavaPATH c) JAVA d) JAVA_HOME Answer: d Explanation: JAVA_HOME is used to store a path to the java installation. The environment variable that is commonly used to set the... 2
- What will be the output of the following Java code? Answer: a Explanation: Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32. 1
- What is the extension of java code files? a) .js b) .txt c) .class d) .java Answer: d Explanation: Java files have .java extension. 2
- Which of these cannot be used for a variable name in Java? a) identifier & keyword b) identifier Answer: c Explanation: Keywords are specially reserved words that can not be used for naming a user-defined variable, for example: class, in... 1
- Which one of the following is not a Java feature? a) Object-oriented Answer: b Explanation: Pointers is not a Java feature. Java provides an efficient abstraction layer for developing without using a pointer i... 1
- Which component is used to compile, debug and execute the java programs? a) JRE b) JIT c) JDK d) JVM Answer: c Explanation: JDK is a core component of Java Environment and provides all the tools, executables and binaries required to compile,... 1
- Which statement is true about Java? a) Java is a sequence-dependent programming language Answer: d Explanation: Java is called ‘Platform Independent Language’ as it primarily works on the principle of ‘compile once, run everywher... 1
- Who invented Java Programming? a) Guido van Rossum b) James Gosling c) Dennis Ritchie d) Bjarne Stroustrup Answer: b Explanation: Java programming was developed by James Gosling at Sun Microsystems in 1995. James Gosling is well known as the fathe... 1
- C Program to find Sum of Diagonal Elements of a Matrix #include<stdio.h> int main() int i, j, rows, columns, a[10][10], Sum = 0; printf("n Please Enter Number of rows and columns : "); scanf("%d... 1
- C Program to Find Hcf and Lcm of Two Numbers #include <stdio.h> #include <conio.h> int main() int a, b, num1, num2, temp, gcd, lcm; printf("Enter two numbersn"); scanf("%d %d", &a, &b);... 1