## Interview Question

• 0

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);

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

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

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

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

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

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

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 );``````

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

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

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.

### 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.