1.
Q1. Visualizing program components as objects is characteristics of what language
Correct Answer
A. Object oriented programming language
Explanation
Visualizing program components as objects is a characteristic of object-oriented programming languages. In object-oriented programming, programs are organized around objects, which are instances of classes that encapsulate data and behavior. This approach allows for modular and reusable code, as well as easier maintenance and understanding of the program's structure. Object-oriented programming languages, such as Java, C++, and Python, provide features and syntax specifically designed to support this paradigm.
2.
Q2. Attribute of an Object is also know as its
Correct Answer
A. State
Explanation
An attribute of an object refers to the characteristics or properties that define its current state. It represents the data associated with the object and can be accessed and modified by the object's methods. Therefore, the correct answer for this question is "State".
3.
Q3. The java language is architecturally
Correct Answer
A. Neutral
Explanation
The correct answer is "neutral". This means that the Java language is not biased towards any particular hardware or operating system. It can run on any platform that has a Java Virtual Machine (JVM) installed, making it highly portable and versatile. Java achieves this neutrality through its "write once, run anywhere" principle, allowing developers to write code that can be executed on different systems without any modifications.
4.
Q4. All Java application programs must have this method to run
Correct Answer
A. Main()
Explanation
The main() method is required in all Java application programs because it serves as the entry point for the program. When a Java program is executed, the main() method is the first method that is called. It is where the program starts its execution and from where it can call other methods or perform necessary operations. Without the main() method, the program would not be able to run as there would be no starting point for the execution.
5.
Q5. Command to execute a compiled java programs is
Correct Answer
B. Java
Explanation
The correct answer is "java" because it is the command used to execute a compiled Java program. Once a Java program is compiled using the "javac" command, the resulting bytecode can be executed using the "java" command followed by the name of the class containing the main method. This command launches the Java Virtual Machine (JVM) and runs the program.
6.
Q6. Identify non-primitive data types in the following declarations
Correct Answer
B. "base ball'
Explanation
The given answer "base ball' is a non-primitive data type because it is a sequence of characters enclosed in double quotes, which makes it a string. Non-primitive data types are those that are derived from primitive data types and are more complex, such as strings, arrays, and objects. In this case, 'b' is a primitive data type (character), 12.34 is a primitive data type (floating-point number), and true is a primitive data type (boolean).
7.
Q7. Which of the following is not mandatory in variable declaration
Correct Answer
B. An assignment
Explanation
In variable declaration, a semicolon is required to indicate the end of the declaration statement. An identifier is necessary to give the variable a name. A type is essential to specify the data type of the variable. However, an assignment (a value assigned to the variable) is not mandatory during the declaration. It is possible to declare a variable without assigning a value to it at the same time.
8.
Q8. What will be the result of compiling following code public class MyClass{ final int i ; public static void main(String[] arguments) { System.out.println(new MyClass().i); }}
Correct Answer
B. Will give compile error
Explanation
The code will give a compile error because the final variable "i" is not initialized. Final variables must be assigned a value before they can be used, and since "i" is not assigned a value, the code will not compile.
9.
Q9. Which of the following values you can assign to variable of type char(1) 'A' (2) 9 (3) "Hello"(4) 12.3
Correct Answer
A. (1) and (2)
Explanation
A variable of type char(1) can only store a single character. Therefore, you can assign the values 'A' and '9' to a variable of type char(1). The value "Hello" is a string and cannot be assigned to a variable of type char(1). The value 12.3 is a decimal number and also cannot be assigned to a variable of type char(1). So, the correct answer is (1) and (2).
10.
Q10. When you attempt to add a float, int and byte the result will be
Correct Answer
A. Float
Explanation
When you attempt to add a float, int, and byte, the result will be a float. This is because when performing arithmetic operations, the data type with the highest precision is used as the result. In this case, the float has the highest precision among the given data types, so the result will be a float.
11.
Q11. The 16 bit coding scheme employed in Java programming is
Correct Answer
A. Unicode
Explanation
The 16-bit coding scheme employed in Java programming is Unicode. Unicode is a character encoding standard that includes a vast range of characters from various writing systems around the world. It allows Java programmers to represent and manipulate text in different languages and scripts. Unlike ASCII, which uses 8 bits and can represent a limited set of characters, Unicode provides a much larger character set and supports internationalization in Java applications.
12.
Q12. Which of the following statements are true(1) A series of statements written to perform a particular task is called"procedure" in Java(2) The return type for a method can be any Java type, including void(3) An important principal of object oriented programming is implementation hiding(4) When you perform mathematical calculations on the unlike data type, java will perform a implicit conversion to unify the types
Correct Answer
B. 2,3 and 4
Explanation
The return type for a method can be any Java type, including void. An important principle of object-oriented programming is implementation hiding. When you perform mathematical calculations on unlike data types, Java will perform an implicit conversion to unify the types.
13.
Q13. Which of the following is not a method access modifier in Java 1.2
Correct Answer
D. Private protected
Explanation
In Java 1.2, the "private protected" access modifier is not available. The available method access modifiers in Java 1.2 are "private", "protected", and "public". The "private protected" combination does not exist in Java 1.2.
14.
Q14. A method named HelloWorld() is void and takes no arguments. If you have to define this method, which of the following is correct declaration
Correct Answer
C. Void HelloWorld();
Explanation
The correct declaration for the method named HelloWorld() is "void HelloWorld();". In this declaration, the method is specified to have a return type of void, indicating that it does not return any value. The method also takes no arguments, as specified in the question.