Question 26
Question text
What will be the output of the following Java code?
public class ApplicationTesterChoose the most appropriate option.
{
public static void main(String[] args)
{
int[] array = {11,22,33,44,55,11};
int searchNumber = 11, position=999;
for(int index=0; index < array.length; index++)
{
if(searchNumber == array[index])
{
position = index;
}
} System.out.println(position);
}
}
Feedback
Question 27
Question text
Predict the line of code
Abstract class Base1
{
protected void getDetails()
{
System.out.println("Base method");
}
public Abstract void demomethod();
}
Abstract class Base2 extends Base1
{
public Abstract void samplemethod();
}
class Derived extends Base2
{
//Line1
}
Feedback
Question 28
Question text
What will be the output of the following Java code?
public class MyClassChoose the most appropriate option.
{
private static int data;
static
{
MyClass.data = 999;
}
public static int getData()
{
return data;
}
public static void setData(int data)
{
MyClass.data = data;
}
}
public class ApplicationTester
{
public static void main(String[] args)
{
MyClass ref1 = new MyClass();
MyClass ref2 = new MyClass();
System.out.print(ref1.getData());
ref2.setData(111);
System.out.println(" " + ref1.getData());
}
}
Feedback
Question 29
Question text
Accenture developed a Java based Application (Vendor Management System) for New Codington city. The product was delivered to New Codington after successful testing on Windows platform. New Codington wants to run the application on their desktop which has Linux platform. What are the MINIMUM resources needed to successfully run the application? Choose the most appropriate option.
Feedback
Question 30
Question text
What will be the output of the following Java code?
public interface MyInterfaceChoose the most appropriate option.
{
int MY_DATA = 100; public void display();
}
public class MyClass implements MyInterface
{
public MyClass()
{
MyInterface.MY_DATA = 200;
//Line-1
}
public void display()
{
System.out.println(MyInterface.MY_DATA);
}
}
public class ApplicationTester
{
public static void main(String[] args)
{
MyInterface ref = new MyClass();
//Line-2 ref.display();
}
}
Feedback
Question 31
Question text
What will be the output of the following Java code?
public class StringTesterChoose the most appropriate option.
{
public static void main(String[] args)
{
String s1=new String("Accenture");
String s2=new String("India Limited");
s1.concat(s2);
System.out.println(s1);
}
}
Feedback
Question 32
Question text
Consider the Java code given below. After the execution of the code what will be the content of "array2 "?
public class TesterChoose the most appropriate option.
{
public static void main(String[] args)
{
int array1[] = {71,12,23,34};
int array2[] = new int[4];
int count = 0;
for (int i = 0; i < array2.length; i++)
{
if(array1[i]%2==0)
{
array2[count]=array1[i];
count++;
}
}
}
}
Feedback
Question 33
Question text
What will be the output of the following Java code?
Employee.java public class EmployeeChoose the most appropriate option.
{
private double salary;
public Employee()
{
this.salary = 10000.0;
}
public static void updateSalary(Employee emp)
{
emp.salary = emp.salary + 10000.0;
//Line-1
}
public double getSalary()
{
return this.salary;
}
}
ApplicationTester .java public class ApplicationTester
{
public static void main(String[] args)
{
Employee emp1 = new Employee();
Employee emp2 = new Employee();
Employee.updateSalary(emp1);
System.out.println(emp1.getSalary() + " " + emp2.getSalary());
}
}
Feedback
Question 34
Question text
What will be the output of the following Java code?
Choose the most appropriate option.
public class ApplicationTester
{
public static void main(String[] args)
{
int[] array = {-9,-11-8,-100,-78};
int minimum = 0;
for(int index=0; index < array.length; index++)
{
if(minimum < array[index])
{ minimum = array[index];
}
}
System.out.println(minimum);
}
}
Feedback
Question 35
Question text
What is the output of the following code?
class AccountChoose the most appropriate option.
{
int balance;
public void createAccount()
{
balance = 1000;
}
public int getMinimumBalance()
{
return balance;
}
}
class SalaryAccount extends Account
{
private String companyName;
public SalaryAccount(String companyName)
{
this.companyName = companyName;
}
public void createAccount()
{
balance = 500;
}
public void checkCompany()
{
if (companyName.equalsIgnoreCase("Accenture"))
{
balance = 0;
}
}
}
public class MainClass
{
public static void main(String[] args)
{
Account account = new SalaryAccount("Accenture");
account.createAccount();
System.out.println("Balance : " + account.getMinimumBalance());
account.checkCompany();
System.out.println("Balance : " + account.getMinimumBalance());
}
}
Feedback
Question 36
Question text
What will be the output of the following Java code?
public class AccountChoose the most appropriate option.
{
public void deposite(int amount)
{
System.out.println("Account deposited with: " + amount);
}
public void transaction()
{
this.deposite(100);
}
}
public class SavingsAccount extends Account
{
public void deposite(int amount)
{
System.out.println("Savings Account deposited with: " + amount);
}
}
public class ApplicationTester
{
public static void main(String[] args)
{
Account account = new SavingsAccount();
account.transaction();
}
}
Feedback
Question 37
Question text
Johana wants to display "Welcome to JS!!" as a pop up message using JavaScript. Which of the following suits her requirement?
Feedback
Question 38
Question text
which of the following code creates a list box from which user can select more than one option?
Feedback
<option> P </option><br />
<option> G </option><br />
<option> S </option><br />
</select>
Question 39
Question text
Which of the following attribute is used by a HTML tag to apply inline style? Choose most appropriate option.
Feedback
Question 40
Question text
Refer to the below code:
<script>Which is the CORRECT code to be inserted at "Line1" to make the JavaScript run properly? Choose most appropriate option
function helloMessage(){
var jsName = //Line1 alert('Hello '+jsName+' !')
}
</script>
<form>
Enter First Name : <input type="text" name="firstName" id="first"><br>
<input type="button" value="Click Here!" onclick="helloMessage()">
</form>
Feedback
Question 41
Question text
What would be the output of the following Java Script?
<html>Choose most appropriate option.
<body>
<script>
var key1=1; document.write(typeof(key1) + " ");
var key2=null; document.write(typeof(key2));
</script>
</body>
</html>
Feedback
Question 42
Question text
Which attribute of the form specifies the name of the web page on the server which will process the form after submission? Choose most appropriate option.
Feedback
Question 43
Question text
Which of the following is the correct html form element to create the checkbox in a web page? Choose most appropriate option.
Feedback
Question 44
Question text
<!DOCTYPE html>What will be printed in alert box in line 1? Choose most appropriate option.
<html>
<body>
<script>
var x = (3 + 3) + 4 + "6"; alert(x);//line 1
</script>
</body>
</html>
Feedback
Question 45
Question text
In HTML, Which of the following is used to merge columns in a table? Choose most appropriate option.
Feedback
Question 46
Question text
What would be the Output of the below java script Code?
<html> <body>Choose most appropriate option.
<script>
var x = 5; var d = (x != "5");
document.write(d +"--");
d = (x === "5"); document.write(d);
</script> </body>
</html>
Feedback
Question 47
Question text
Which method is used to remove focus from the specified object? Choose most appropriate option.
Feedback
Question 48
Question text
Consider the javascript code given below. What would be the print values from line 1 and line 2 on execution?
<html>
<body>
<p id="id1"></p><!-- line 1-->
<p id="id2"></p><!-- line 2-->
<script>
var y=10;
myFunction();
document.getElementById("id1").innerHTML = y;
document.getElementById("id2").innerHTML = window.y;
function myFunction() {
y=20;
y=y+window.y
}
</script>
</body>
</html>
Choose the most appropriate option.
Feedback
Question 49
Question text
Consider the HTML code given below.
<html>
<head>
<script>
var key=10;
function add(){
var key=20;
window.key=key+1;
document.write(key);
document.write(" ");
print();
}
function print(){
document.write(key);
}
</script>
</head>
<body>
<form>
<input type="submit" onclick="add()" />
</form>
</body>
</html>
What will be displayed after executing the above code?
Choose the most appropriate option.
Feedback
Question 50
Question text
How many cells will be created after executing the below HTML code?
<html>
<body>
<table border="1">
<tr> <td colspan="3"> Jack </td> </tr>
<tr> <td colspan="2"> Tom </td> <td> Mark </td> </tr>
<tr> <td rowspan="2"> John</td> <td> James</td> <td>Mary</td> </tr>
<tr> <td> Helen</td> <td> Sam </td> </tr>
</table>
</body>
</html>
Comments
Post a Comment