Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Multiple Choice Questions Questions attempted: 12 of 12

 # Questions (12) Result Score (58/58)

1 File Name: A.java  5/5


public class A {
public void xyz() {
}
}
File Name: B.java
public class B extends A
{ public void xyz() {
...
Options

A. A's xyz method will be called

B. B's xyz method will be called

C. The program will give a compilation error CORRECTLY ATTEMPTED

D. The program will give a run time error

2 A boatman goes 12 km against the current of the stream in 6 hours and goes  5/5
2 km along the current in 50 minutes. How long will it take for him to go 8
km in still water?

[Note...

Options

A. 3 hrs 30 mins

B. 3 hrs 38 mins CORRECTLY ATTEMPTED

C. 2 hrs

D. 2 hrs 30 mins

3 File Name: A.java  5/5


public class A {
public void xyz() {
}
}
File Name: B.java
public class B extends A
{ public void xyz() {...

Options

A. A's xyz method will be called

B. B's xyz method will be called CORRECTLY ATTEMPTED

C. The program will give a compilation error

D. The program will give a run time error

4 Bob has allocated a budget x for painting his shop. However, the price of paint  5/5
increases by 45%.

If Bob decides to spend an additional 30% of x for buying paint then by what ...
Options

A. 15.66 %

B. 10.34 % CORRECTLY ATTEMPTED

C. 0.1233

D. 14.34 %

5 You are asked to use two pipes A and B to ll a tank that has another pipe C at  5/5
the bottom of it. Given that pipes A and B can ll the tank in 15 and 20 minutes,
respectively...

Options

A. 300 gallons CORRECTLY ATTEMPTED

B. 400 gallons

C. 450 gallons

D. 350 gallons

6 A shoemaker incurs an expense of Rs. 200 for producing a shoe. She also incurs  4/4
an additional expenditure of Rs. 50,000, independent of the number of shoes
produced. If she can ...
Options

A. 1200

B. 1500

C. 1000 CORRECTLY ATTEMPTED

D. 900

7 A library has a collection of books out of which 55% books are more than 50  4/4
years old and 60% books are less than or equal to 70 years old. Also, 40% of the
books in the librar...
Options

A. 48 %

B. 56 %

C. 60 % CORRECTLY ATTEMPTED

D. 54 %

8 Mr John walks to a party at his friend's house for christmas in 2017. His  5/5
friend introduces him to a girl named Alice who is a mathematician.
3 years later, Mr John runs into A...
Options

A. 17 years
B. 18 years

C. 17 years

D. 22 years CORRECTLY ATTEMPTED

9 A school has two alarms A and B. Alarm A rings once every two hours and  5/5
alarm B rings once every four hours.

Determine the percentage by which the number of times A would ring...

Options

A. 100% CORRECTLY ATTEMPTED

B. 120%

C. 150%

D. 110%

10 At what time will the minute hand and hour hand of a wall clock make one-  5/5
third angle of the right angle between 8 pm and 9 pm?

[Note: Select the accurate time in hours and min...

Options

A. 8:49 PM CORRECTLY ATTEMPTED

B. 8:20 PM

C. 8:40 PM

D. 8:37 PM

11 File Name: MyClass.java  5/5


public class MyClass {
public static void main(String args[]) {
xyz('1');
}

...

Options

A. The following method will be called: void xyz(int i)

B. The following method will be called: int xyz(int i)

C. The following method will be called: void xyz(char c)

D. The program will give a compilation error CORRECTLY ATTEMPTED

12 File Name: A.java  5/5


public class A {
public A() {
}

public void xyz() {


}
}

File Name:
B.java public
class ...
Options

A. The calls will be made in the following order: A's constructor, B's constructor,
B's xyz method CORRECTLY ATTEMPTED

B. The calls will be made in the following order: A's constructor, B's constructor,
A's xyz method, B's xyz method

C. The calls will be made in the following order: B's constructor, A's constructor,
B's xyz method
D. The program will give a run time error

Subjective Questions Questions attempted: 1 of 1

 # Questions (1) Score (0/50)

1 Create a database schema for online shopping website using 0/50


following business de nition
1. Website will have lot of customers
2. Customers can place multiple orders
3. E...

Submission
CREATE TABLE customer(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
First_name varchar(50) not null,
last_name varchar(50) not null,
email varchar(50) not null,
mobile varchar(10) not null
password varchar(50) not null)
foreign key (id,email,mobile);
CREATE TABLE shop.order(
id BIGINT NOT NULL,
ITEMS varchar(5) ,
price_of_items BIGINT ,
type_of_item varchar(20),
no_of_order int null default null,
primary key (id),
FORIGN KEY(id,items,price_of items));
CREATE TABLE shop.address(
id BIGINT NOT NULL
location varchar(20),
state varchar(20) not null,
country varchar(20),
permanent_address varchar(50) not null,
present_address varchar(50) not null,);
1. SELECT customer.first_name, customer.email FROM customer where order.items=0;
2.SELECT customer.first_name,customer.email from customer where no_of_order>=3;

Programming Questions Questions attempted: 2 of 2

 # Questions (2)
Code
No. of attempts Result quality Score (80/80)

1 Farthest From Zero

Given an integer array A of size N. Write a program to print the farthest


element from 0. (Number with highest absolute value negative or positive)
If there are multiple eleme...

Score Result Time Memory Language Submitted on


40 BEST 0.1196 sec 82984 KB Java 8 May 21, 2022 07:24 PM IST

Play code

Java 8 Play code link

 Submission details

Submission ID: 71709137 | May 21, 2022 07:24 PM IST


LANGUAGE
RESULT SCORE TIME MEMORY

Java 8
Accepted 40/40 0.1196 sec 82984 KB
Input Result Time (in sec) Memory (in KB) Score Input File Output Expected output

Input #1 0.058685 82984 20   

Input #2 0.060913 82356 20   

 Compilation log

Compilation Successful.

Code quality  8/10

MAINTAINABILIT CYCLOMATIC COMPLEXITY


Y
9/10
8/10

 Source code Plaintext Link


Show violations

1 import java.io.*;
2 import java.util.*;
3
4 1 import sun.security.util.Length;

Use classes from the Java API instead of Sun

classes. Classes from "sun.*" packages should not

be used

5
6
7 public class TestClass {
8 public static void main(String[] args) throws IOException {
9 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
10 1 PrintWriter wr = new PrintWriter(System.out);

Replace this use of System.out or System.err by a logger.

Standard outputs should not be used directly to log anything

11 1 int N = Integer.parseInt(br.readLine().trim());

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

Local variable and method parameter names should comply with a naming convention

12 1 int[] A = new int[N];

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.


Local variable and method parameter names should comply with a naming convention

13 String[] inp = br.readLine().split(" ");


14 for(int i=0;i<N;i++)
15 {
16 A[i] = Integer.parseInt(inp[i]);
17 }
18 1 int out_ = solve(N, A);

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

Local variable and method parameter names should comply with a naming convention

19 1 System.out.println(out_);

Replace this use of System.out or System.err by a logger.

Standard outputs should not be used directly to log anything

20
21 wr.close();
22 br.close();
23 }
24 3 static int solve(int N,int[] A){

Remove this unused method parameter "N".

Unused method parameters should be removed

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.


Local variable and method parameter names should comply with a naming convention

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.


Local variable and method parameter names should comply with a naming convention

25 Arrays.sort(A);
26 1 int Length=A.length;

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

Local variable and method parameter names should comply with a naming convention

27 return (A[Length-1]>Math.abs(A[0])?A[Length-1]:A[0]);
28 }
29 }

Code quality report is generated by using Major violations (4) Minor violations (6)
SonarQube V7.8

3 8/10 40/40

2 Median Queries

You are given an array A consisting of N elements.

For a subarray of A of length , you have to sort the elements of the


subarray in a non-decreasing order. The element ...

Score Result Time Memory Language Submitted on


40 BEST 0.13136 sec 83108 KB Java 8 May 21, 2022 07:24 PM IST

Play code
Java Play code link
Java 8 Play code link

 Submission details

Submission ID: 71709126 | May 21, 2022 07:24 PM IST

RESULT SCORE TIME MEMORY LANGUAGE

Accepted 40/40 0.13136 sec 83108 KB Java 8

Input Result Time (in sec) Memory (in KB) Score Input File Output Expected output

Input #1 0.069741 83108 20   

Input #2 0.06162 82308 20   

 Compilation log

Compilation Successful.

 Source code Plaintext Link

1 import java.io.*;
2 import java.util.*;
3
4 class TestClass {
5 public static void main(String args[] ) throws Exception {
6 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7 PrintWriter wr = new PrintWriter(System.out);
8 int N = Integer.parseInt(br.readLine().trim());
9 int[] A = new int [N];
10 String[] inp = br.readLine().split(" ");
11 for(int i=0;i<N;i++)
12 {
13 A[i] = Integer.parseInt(inp[i]);
14 }
15 int Q = Integer.parseInt(br.readLine().trim());
16 for(int i=0;i<Q;i++) {
17 String[] inp1 = br.readLine().split(" ");
18 int L = Integer.parseInt(inp1[0]);
19 int R = Integer.parseInt(inp1[1]);
20 int out_ = solve(N, A, L ,R);
21 System.out.println(out_);
22 }
23 wr.close();
24 br.close();
25 }
26 static int solve(int N, int[] A, int L, int R) {
27 int [] subArray=Arrays.copyOfRange(A,L-1,R);
28 int length=subArray.length;
29 Arrays.sort(subArray);
30 if(length==1){
31 return subArray[0];
32 }else if ((length%2)==0){
33 return subArray[(length/2)-1];
34
35 }else{
36 return subArray[(length/2)];
37 }
38
39 }
40 }

You might also like