1.
Int i;
int sum=0;
for(i=2;i<=10;i+=2)
sum+=i;
System.out.println(""+sum);
what is the output of the above program?
Correct Answer
B. 30
Explanation
The given program initializes a variable 'sum' to 0. Then, it enters a for loop with the variable 'i' starting from 2 and incrementing by 2 until it reaches 10. Inside the loop, it adds the value of 'i' to 'sum'. After the loop, it prints the value of 'sum'. Since the loop adds all even numbers from 2 to 10, the final value of 'sum' is 30. Therefore, the output of the program is 30.
2.
String str1="Raj",str2="Kumar";
String str3=str1+ " " + str2;
System.out.println(""+str3);
what is the output of the above program?
Correct Answer
B. Raj Kumar
Explanation
The given code concatenates the strings "Raj" and "Kumar" with a space in between using the + operator. The result is stored in the variable str3. Finally, the code prints the value of str3, which is "Raj Kumar". Therefore, the output of the program is "Raj Kumar".
3.
Int X=10;
int a=12,b=5;
int c=(int)a/b;
switch(c)
{
case 1:
X=X+2;
case 2:
X=X + 2;
default :
X=X+1;
}
System.out.println(""+X);
Correct Answer
B. 13
Explanation
In this code, the value of 'c' is calculated by dividing 'a' by 'b'. Since 'a' and 'b' are both integers, the result will be an integer. In this case, 'a' divided by 'b' is 2. The switch statement then checks the value of 'c'. Since 'c' is 2, it matches the case 2 and the code inside that case is executed. This code adds 2 to the value of 'X', making it 12. However, there is no break statement after this case, so the code continues to execute the default case. The code inside the default case adds 1 to the value of 'X', making it 13. Therefore, the final value of 'X' is 13, which is the correct answer.
4.
Int day=5;
switch(day)
{
case 10:
System.out.println("India");
default :
System.out.println("Invalid");
}
What will be the output of the above program?
Correct Answer
B. Invalid
Explanation
The output of the above program will be "Invalid". This is because the value of the variable "day" is 5, which does not match any of the cases in the switch statement. Therefore, the default case will be executed, and "Invalid" will be printed.
5.
In which phase you will check if the software is according to user specifications?
Correct Answer
C. Testing
Explanation
In the testing phase, the software is checked to ensure that it meets the user specifications. This phase involves running various tests to identify any errors, bugs, or discrepancies in the software's functionality. By conducting thorough testing, developers can verify that the software performs as intended and meets the requirements set by the users. This phase is crucial in ensuring the quality and reliability of the software before it is deployed or released to the users.
6.
What will happen if you do not specify a condition in delete statement?
Correct Answer
B. All records will be deleted
Explanation
If you do not specify a condition in a delete statement, it means that the delete statement will not have any criteria to determine which records should be deleted. As a result, all records in the table will be considered for deletion and ultimately, all records will be deleted from the table.
7.
Which of the following are open source?
Correct Answer(s)
B. Netbeans
C. MYSQL
Explanation
Netbeans and MYSQL are open source. Netbeans is an open-source integrated development environment (IDE) used for Java, while MYSQL is an open-source relational database management system. Open source means that the source code of the software is freely available for anyone to view, modify, and distribute. Microsoft Office and Outlook Express are not open source as they are proprietary software developed by Microsoft.
8.
Select length('Raj Kumar');
Correct Answer
B. 9
Explanation
The given SQL query is selecting the length of the string 'Raj Kumar'. The length function in SQL returns the number of characters in a string. In this case, the string 'Raj Kumar' has a length of 9 characters, so the correct answer is 9.
9.
Net beans is an IDE?
Correct Answer
A. True
Explanation
NetBeans is an integrated development environment (IDE) used primarily for Java programming. It provides tools and features to support the development of Java applications, including a code editor, debugger, and graphical user interface builder. Therefore, the statement "NetBeans is an IDE" is true.
10.
Which of the following are DML statements?
Correct Answer(s)
A. Insert
B. Update
C. Delete
Explanation
The correct answer is Insert, Update, and Delete. These three statements are known as Data Manipulation Language (DML) statements in SQL. They are used to manipulate data in a database. The Insert statement is used to insert new rows of data into a table, the Update statement is used to modify existing data in a table, and the Delete statement is used to remove rows of data from a table. Create and Drop are not DML statements, they are Data Definition Language (DDL) statements used to create and drop tables.