Mock1 MCQ Java 21 Nov MUM With Answers

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Mock1_MCQ_Java_21_Nov_… 30 minutes

Question - 1 SCORE: 1 points


PRA_Unx_Qn1

unix

Find out the error in the following shell script

x=10
if [ $x -gt 2 ]
echo x
fi

Line 4 should be echo x

If syntax is incorrect

x=10 is not legal assignment

Line 2 syntax is wrong

Question - 2 SCORE: 1 points


PRA4_Unix2

unix

The file product.txt has following content:

No Name Price Quantity


Availability
=================================================
===========
1 Johnson&Johnson 520 3
Yes
2 Lux 340 3
Yes
3 Rexona 150 2
Yes
4 Vim 20 0
No
5 Ponds 34 0
No

Which command will display below output

Johnson&Johnson 3
Lux 3
Rexona 2

awk 'BEGIN{FS=" "}{if ($5 == "Yes"){print $2,$4}}' product.txt

1/12
awk 'BEGIN{FS=" "}{if ($5 == 'Yes'){print $2,$4}}' product.txt

awk 'BEGIN{FS=" "}{if ("Availability" == "Yes"){print $2,$4}}' product.txt

awk 'BEGIN{FS=" "}{if ($5 == "Available"){print $2,$4}}' product.txt

Question - 3 SCORE: 1 points


PRA4_Unix3

unix

What will the following command do?


sed -n '2,10p' file1

Display lines 2 to 10 from file 1

Display all the lines except 1 and 10 from file 1

Display the 10th word of the 1st line from file1

None of the options

Question - 4 SCORE: 1 points


PRA4_Unix5

unix

The following command will not get executed as there is no BEGIN


statement

awk '/100/ {count++} END {print count}' file.txt

TRUE

FALSE

Question - 5 SCORE: 1 points


PRA_Unx_Qn5

unix

Identify the statement that will print the


following message
Hello unix

name=uinx
echo "Hello $name"

2/12
name=unix
echo "Hello name"

name=unix
print Hello $name

name=unix
print "Hello $name";

Question - 6 SCORE: 1 points


PRA_SQL_Qn6

sql

The value of Primary key

can be duplicated

can be null

cannot be null

None of these

Question - 7 SCORE: 1 points


PRA_SQL_Qn7

sql

To remove a relation from an SQL database, we use the ______


command.

Delete

Purge

Remove

Drop table

Question - 8 SCORE: 1 points


PRA_SQL_Qn8

sql

which of the following is the query to get


Orderdetails whose OrderPrice is 1500,2500 ?
Orders

OId OrderDate OrderPrice


Customer

3/12
1 2019/2/12 1500
Sujatha
2 2018/09/23 300
Nandini
3 2018/05/27 700
Sujatha
4 2017/08/03 1500
Sujatha
5 2017/04/09 2500
Jaswanth
6 2017/06/24 100
Nandini

SELECT * FROM Orders WHERE OrderPrice=1500 or OrderPrice=2500;

SELECT * FROM Orders WHERE OrderPrice BETWEEN(1500,2500);

SELECT * FROM Orders WHERE OrderPrice=1500 and OrderPrice=2500;

SELECT * FROM Orders WHERE OrderPrice IN(1500,2500);

Question - 9 SCORE: 1 points


PRA4_SQL2

sql

Which is NOT an aggregate function in SQL?

LENGTH()

Count()

SUM()

MIN()

Question - 10 SCORE: 1 points


PRA4_SQL3

sql

With SQL, how do you select all the records from a table named
"Toddler" where the value of the column "Name" starts with "A"?

SELECT * FROM Toddler WHERE Name LIKE '%A'

SELECT * FROM Toddler WHERE Name='A'

SELECT * FROM Toddler WHERE Name LIKE 'A%'

SELECT * FROM Toddler WHERE Name='%A%'

4/12
Question - 11 SCORE: 1 points
PRA_PLSQL_Qn11

plsql

Consider the below Employee table. Predict the


output for the below code
Employee_ID Employee_Name
1 Kartik
2 Vimal
3 Shobha

Set serveroutput on;


declare
v_employee_id employee.employee_id%type;
v_employee_name employee.employee_name%type;
begin
select employee_id,employee_name into
v_employee_id,v_employee_name from employee;
dbms_output.put_line('Output is'|| SQL%rowcount);
end;
/

Output is 2

Displays error since the variable declaration is incorrect

None of the options

Displays an error "exact fetch returns more than requested number of


rows "

Question - 12 SCORE: 1 points


PRA4_PLSQL7

plsql

Which of the following blocks are mandatory in PL/SQL program?

DECLARE

BEGIN

EXCEPTION

END

Question - 13 SCORE: 1 points


PRA4_PLSQL8

plsql

Predict the output for the below code :


5/12
declare
i number ;
begin
dbms_output.put_line('Salary is ' || i);
end;
/

Will return an error since the variable is not intialised

Will give the output:


Salary is

Will give the output:


Salary is 0

Will return an error since the size is not mentioned in the variable
declaration

Question - 14 SCORE: 1 points


PRA4_PLSQL9

plsql

Select the correct SQL query syntax to add a column to a table.

ALTER TABLE table_name


ADD COLUMN column_name datatype;

ALTER table_name
ADD column_name datatype;

ALTER TABLE table_name


ADD column_name datatype;

ALTER table_name
ADD COLUMN column_name datatype;

Question - 15 SCORE: 1 points


PRA4_SQL10

plsql

Write a sql query to update the designation as 'ITA' when location is null

update Employee set designation='ITA'

update Employee set designation ='ITA' where location is null

update Employee modify designation='ITA' where location=null

None of these

6/12
Question - 16 SCORE: 1 points
PRA_UI_Qn16

ui

Identify the statement that can be used in Javascript to Create a


variable called carName, assign the value Honda City to it.

carName="Honda City";

var carName = "Honda City";

carName=Honda City;

variable carName ="Honda City";

Question - 17 SCORE: 1 points


PRA_UI_Qn17

ui

Following is a variable declaration statement in Javascript:


var x = {firstName:"TCS", lastName:"ILP"};
What will be the data type of x?

string

character array

object

none of the options

Question - 18 SCORE: 1 points


PRA_UI_Qn18

ui

What is the output of the below code snippet?


<script>
var Str = "16";
var Str1 = " Number is ";
document.write(Str1.concat(Str));
</script>

Number is 16

16 Number is

16

Will not print anything


7/12
Question - 19 SCORE: 1 points
PRA_UI_Qn19

ui

In HTML, which attribute is used to specify that an input field must be


filled out?

required

validate

formvalidate

placeholder

Question - 20 SCORE: 1 points


PRA_UI_Qn20

ui

Which header tag defines the smallest heading?

<h6>

<h1>

<h0>

None of the above

Question - 21 SCORE: 1 points


PRA_UI_Qn21

ui

What will be the output of below code snippet?


<html>
<body>
<p><a href="https://www.google.com/" target=_self>Click Me</a></p>
</body>
</html>

On clicking the 'Click Me' link, it will open google.com in a new window
or tab

On clicking the 'Click Me' link, it will open google.com in the same
window or tab as it was clicked

8/12
On clicking the 'Click Me' link, it will open google.com in the full body of
parent frame

On clicking the 'Click Me' link, it will open google.com in the full body of
the window.

Question - 22 SCORE: 1 points


PRA_UI_Qn22

ui

What will be the output of below code snippet?


<html>
<body>
<div style="background-color:blue;color:white">
<p>Physical fitness is a state of health and
well-being.</p>
</div>
</body>
</html>

The below text will be displayed in blue background

Physical fitness is a state of health and well-being.

The below text will be displayed in black font

Physical fitness is a state of health and well-being.

The below text will be displayed in white font and white background

Physical fitness is a state of health and well-being.

The below text will be displayed in white font and blue background

Physical fitness is a state of health and well-being.

Question - 23 SCORE: 1 points


PRA_UI_Qn23

ui

Inline container which is used to mark up a part of a text, or a part of a


document.

span

select

9/12
b

Question - 24 SCORE: 1 points


PRA_UI_Qn24

ui

<html>
<body>
<p id="sample"><b>Welcome To Car World</b> </p>
<script>
var cars = ["BMW", "Honda", "Maruti"];
cars.push("Jaguar");
var c2=cars.pop();
cars.push("Benz");
document.getElementById("sample").innerHTML = c2;
</script>
</body>
</html>

What could be the output of the above script?

Maruti

Benz

Jaguar

Undefined

Question - 25 SCORE: 1 points


PRA_UI_Qn25

ui

The title tag is used inside which tag to mention the document title.

body

header

head

doctype

Question - 26 SCORE: 1 points


PRA_Java_Qn26

java

Inserting any value in the wrong index as shown below will result in

10/12
int A[]=new int[3];
A[5]=5;

NullPointerException

ArrayIndexOutOfBoundsException

ArithmeticException

Program executes successfully

Question - 27 SCORE: 1 points


PRA_Java_Qn27

java

To use a package , keyword used is

package

packagename

import

None of the options

Question - 28 SCORE: 1 points


PRA_Java_Qn28

java

public class Test {

public static void main(String[] args)


{
String str[] = {"Array","is","easy to
learn"};
System.out.println(str[2]);
}}
What is the output of the above code?

is

easy

error

easy to learn

Question - 29 SCORE: 1 points

11/12
PRA_Java_Qn29

java

public class Test {

public static void main(String[] args)


{
String str = "Welcome to TCS";
System.out.println(str.contains("Welcome"));
}}
What is the output of the above code?

TRUE

FALSE

Question - 30 SCORE: 1 points


PRA_Java_Qn30

java

class Demo {
public static void main(String[] args)
{
Short a=365;
System.out.println(a++);
}}
What is the output of the above code?

366

TRUE

365

error

12/12

You might also like