Interview Question


Country: United States
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
0
of 0 vote

Given the declaration int x = 0, y; evaluate the following expression;

y = (--x) + (x++) – (x) + (++x) + (x--) - (++x);

- Anonymous November 15, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

y=(-1) + (-1) – (0) + (1) + (1) - (1);
y=1

- Pooja Singh November 16, 2020 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

y = (-1) + (-1) – (0) + (1) + (1) - (1);
y=1;

- pooja.onweb November 16, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

y = (-1) + (-1) – (0) + (1) + (1) - (1);
y=-1;

- steep November 24, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Here is the SQL using that you can achieve the same:

Result = SELECT movie_id, actor_id, gender FROM Movie_Actor, Actor INNERJOIN ON Movie_Actor.actor_id==Actor.actor_id;

JoinResult = SELECT A.movie_id AS movie_id1, A.actor_id AS actor_id1, A.gender AS gender1, B.movie_id AS movie_id2, B.actor_id AS actor_id2, B.gender AS gender2 WHERE Movie_Actor AS A, Movie_Actor AS B WHERE A.movie_id==B.movie_id;

JoinResult = SELECT * WHERE (gender1=='Male' AND gender2=='Female') OR (gender1=='Female' AND gender2=='Male') FROM JoinResult;

JoinResult = SELECT actor_id1,actor_di2,COUNT(movie_id) AS TotalMovies FROM JoinResult GROUP BY actor_id1,actorid2;

Answer = SELECT actor_id1, actor_id2 FROM JoinResult WHERE TotalMovies == MAX(TotalMovies );

- jatinkhurana9 November 27, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

With Male as (SELECT Actor. actor_id as MaleActor, Movie_Actor.movie_id as M_id1 from Actor INNER JOIN Movie_Actor ON Actor.actor_id = Movie_Actor.actor_id
where Actor.gender = "M")

With Female as (SELECT Actor. actor_id as FemaleActor, Movie_Actor.movie_id as M_id2 from Actor INNER JOIN Movie_Actor ON Actor.actor_id = Movie_Actor.actor_id
where Actor.gender = "F")

SELECT Female.FemaleActor as Actress, Male.MaleActor as Actor from Female INNER JOIN Male on Female.M_id2=Male.M_id1

- R2D2 February 13, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Previous answer starts good but not complete: the person had created the pairs but had not been selecting the one that had been appearing the most. Let me complete:

With Male as (SELECT Actor. actor_id as MaleActor, Movie_Actor.movie_id as M_id1 from Actor INNER JOIN Movie_Actor ON Actor.actor_id = Movie_Actor.actor_id
where Actor.gender = "M")

With Female as (SELECT Actor. actor_id as FemaleActor, Movie_Actor.movie_id as M_id2 from Actor INNER JOIN Movie_Actor ON Actor.actor_id = Movie_Actor.actor_id
where Actor.gender = "F")

SELECT female.actor_id as actress, male.actor_id as actor
FROM female
INNER JOIN male on female.movie_id=male.movie_id
GROUP BY actress, actor
ORDER BY COUNT(*) DESC
LIMIT 1

- Mounia March 02, 2021 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More