0% found this document useful (0 votes)
383 views11 pages

Ode 2 Code Challenge Problems

The document contains 9 coding problems with multiple choice answers. Problem 1 asks about the output of a JavaScript regular expression code snippet. Problem 2 asks about the output of some HTML code. Problem 3 asks about which cloud computing option best suits a given task description. The remaining problems ask about outputs of code snippets in languages like SQL, C++, Java, and HTML/CSS.

Uploaded by

Rahul Patel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
383 views11 pages

Ode 2 Code Challenge Problems

The document contains 9 coding problems with multiple choice answers. Problem 1 asks about the output of a JavaScript regular expression code snippet. Problem 2 asks about the output of some HTML code. Problem 3 asks about which cloud computing option best suits a given task description. The remaining problems ask about outputs of code snippets in languages like SQL, C++, Java, and HTML/CSS.

Uploaded by

Rahul Patel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

9/18/21, 12:57 PM Problems - Ode 2 Code

Problems - Ode 2 Code


[Link]/challenges/hiring/ode-2-code/problems/32be552b47df4eac8352284bdd7545b2

1.
What is the output of the Javascript code snippet given below:

Code

var a = /xy/i,

b = new RegExp(a, "g");

[Link]([Link]("xy"));

[Link]([Link]("xy"));

[Link]([Link]("XY"));

[Link]([Link]("XY"));

Output

1.

true

true

true

true

2.

true

true

true

false

3. 

true

true

false

false

4. 

false

false

false

false

+ 4.0

2.
What is the output of the following HTML code?
Code

[Link] 1/11
9/18/21, 12:57 PM Problems - Ode 2 Code

<!DOCTYPE html5>

<html>

<head></head>

<body>

<table border=2>

<tbody>

<tr>

<th colspan="4">Greet</th>

</tr>

<tr>

<td rowspan="2">hackerearth</td>

<td colspan="1" rowspan="1">hi</td>

<td colspan="2">noice</td>

</tr>

<tr>

<td colspan="3">good-bye</td>

</tr>

<tr>

<td colspan="1" rowspan="2">Hackerearth</td>

<td colspan="3">good night</td>

</tr>

<tr>

<td colspan="2">good</td>

<td colspan="1" rowspan="2">byee</td>

</tr>

<tr>

<td rowspan="2">hack</td>

<td colspan="2" rowspan="1">hello world</td>

</tr>

</tbody>

</table>

</body>

</html>

Output

1.
2.
3.
4.

+ 2.0

3.
In Cloud Computing, John was given
the task of creating multiple simulated
environments from a single physical
hardware system. The organization
wants to partition their old server and run legacy apps per their testing needs. Then,
which option suits the best to achieve the requirements?

[Link] 2/11
9/18/21, 12:57 PM Problems - Ode 2 Code

+ 2.0

4.
You have two tables called Employee
and Department.

Employee

Field Type

EmployeeId int

EmployeeName text

DepartmentId int

Department

Field Type

DepartmentId int

DepartmentName text

Sample:

Employee

EmployeeId EmployeeName DepartmentId

1 Bob 1

[Link] 3/11
9/18/21, 12:57 PM Problems - Ode 2 Code

EmployeeId EmployeeName DepartmentId

2 John 1

3 Mike 1

4 Mary 2

5 Anita 2

Sample:

Department

DepartmentId DepartmentName

1 IT

2 HR

3 Payroll

4 Admin

Sample Output

DepartmentName EmployeeName

IT Bob

IT John

IT Mike

HR Mary

HR Anita

Using the Employee and Department tables, which of the following queries will return
the same sample output:

Queries

1.

select DepartmentName,EmployeeName from Employee JOIN Department ON


[Link]=[Link];

2.

select DepartmentName,EmployeeName from Employee LEFT JOIN Department ON


[Link]=[Link];

[Link] 4/11
9/18/21, 12:57 PM Problems - Ode 2 Code

3.

select DepartmentName,EmployeeName from Employee RIGHT JOIN Department ON


[Link]=[Link];

+ 6.0

5.
What will be the color of the text "Hello" in the following HTML and CSS code?

Code

<html>

<head>

<style>

ul#decoration #list {

color: green;

.like span {

color: yellow!important;

</style>

</head>

<body>

<ol class="greet" id="decoration">

<li>Hi</li>

<li class="like" id="list"><span class="hello">Hello</span></li>

</ol>

</body>

</html>

+ 4.0

6.
What is the output for the following C++ code?

Code

[Link] 5/11
9/18/21, 12:57 PM Problems - Ode 2 Code

#include <iostream>

using namespace std;

class F

};

class S : public F

};

template<typename X, typename Y>

class check

class F { };

static F find( ... );

class T { F f[2]; };

static T find( Y* );

public:

enum

m = sizeof(T) == sizeof(find(static_cast<X*>(0)))

};

};

template <class Q, class R>

bool checkIf()

return check<Q, R>::m;

int main()

check <class F, class S> t (F,S);

cout << checkIf<class F, class S>() <<endl;

return 0;

+ 6.0

7.
Which of the following statements is correct if you execute the following C++ code?
Code

[Link] 6/11
9/18/21, 12:57 PM Problems - Ode 2 Code

#include <iostream>

using namespace std;

template <typename T>

struct func

void x()

cout << "hi" << endl;

void y()

cout << "hello" << endl;

};

template <>

void func<int>::x()

cout << "hello world" << endl;

int main()

func<int> t;

t.x();

t.y();

Statements
1. The code produces the following output:

hi

hello

2. The code produces the following output:

hello world

hello

3. The code produces the following output:

hello world

hi   

hello

4. The code does not give any runtime error

+ 4.0

8.
What is the output of the following Java code?

Code

[Link] 7/11
9/18/21, 12:57 PM Problems - Ode 2 Code

public class Hackerearth

private static int hack;

public Hackerearth()

hack++;

protected static int hack_method()

return hack;

public static void main(String[] args)

Hackerearth h1 = new Hackerearth();

Hackerearth h2 = new Hackerearth();

Hackerearth h3 = new Hackerearth();

Hackerearth h4 = new Hackerearth();

Hackerearth h5 = new Hackerearth();

Hackerearth h6 = new Hackerearth();

[Link]++;

[Link](hack_method());

Output

1. 6

2. 7

3. 0

+ 4.0

9.
In an Operating System, which of these refers to the situation where the processor spends
most of its time swapping processes rather than executing instructions?

+ 4.0

10.
You have to choose an SDLC model for a project. The software has to be developed in
increments and each increment has to be developed iteratively. Which of the following
points about the incremental model makes it capable or incapable of being used for the
specified project?

+ 2.0

11.
Based on the following table, what is the output of the SQL query:

[Link] 8/11
9/18/21, 12:57 PM Problems - Ode 2 Code

STUDENT

ID NAME AGE

15 Bob 20

20 Alice 18

105 Mike 25

151 Tara NULL

Query 

select NAME from STUDENT where AGE<(select avg(AGE) from STUDENT);

Output

1. 

NAME

Alice

Mike

2. 

NAME

Mike

Bob

3. 

NAME

Bob

Alice

+ 4.0

12.
What is the output of the following C code?

Code

[Link] 9/11
9/18/21, 12:57 PM Problems - Ode 2 Code

#include<stdio.h>

#include<string.h>
int main()

static int num[3]={[0]=5,[2]=7};

printf("%d",num[1]);

+ 6.0

13.
In Networking, you are working on the various layers of an OSI model. Now, which of the
following represent the functions of a Data Link Layer (DLL):

1. Logical addressing
2. Framing
3. Error control
4. Access control
5. Routing
6. Flow control
7. Physical addressing

+ 2.0

14.
What is the output of the following C code?

Code

#include <stdio.h>
int *testhack()

static int val = 5;

return &val;

int main()

int *hck = testhack();

fflush(stdin);
printf("%d",*hck);

+ 4.0

15.
What is the output of the following Java code?

Code

[Link] 10/11
9/18/21, 12:57 PM Problems - Ode 2 Code

import [Link].*;

import [Link].*;

class Main {

int a;int b=9;

public int sum()

return a+b;

private int add()

return a+b;

int result()

return new Main().add();

public class Examp3

public static void main(String []aa)

Main e=new Main();

[Link]([Link]()+[Link]());

+ 6.0

[Link] 11/11

You might also like