#include<iostream>
using namespace std;
class ComplexNum {
int r, i;
public:
ComplexNum(int _r, int _i) : r(_r), i(_i) { }
ComplexNum& _____________{ //LINE-1
__________ //LINE-2
__________ //LINE-3
}
ComplexNum ______________{ //LINE-4
_________ //LINE-5
_________ //LINE-6
return t;
}
Get all the distinct user_ids who liked at least one video uploaded by Android Authority Channel (channel__id = 364) but didn't like the video uploaded by Tech savvy channel with video_id = 1005.
Split and Replace
Given three strings
inputString, separator and replaceString as inputs. Write a JS program to split the
inputString with the given separator and replace strings in the resultant array with the replaceString whose length is greater than 7.
Quick Tip
Sample Input 1
JavaScript-is-amazing
-
Programming
Sample Output 1
Programming is amazing
Sample Input 2
The&Lion&King
&
Tiger
Sample Output 2
The Lion King
Check values in the Array is a String
Given an array
Sample Input 1
[ 'frozen', 'rock', 'stained', 'basket' ]
Sample Output 1
true
Sample Input 2
[ 'recycling', 70, 'pastime', 'animal' ]
Sample Output 2
false
Get all the recent movie trailers that have more than 1 lakh views.
Note:
Consider the videos that have "trailer" in theirnameas trailers.
Sort the output in the descending order ofno_of_viewsandpublished_datetime
Expected Output Format
name channel_id no_of_views published_datetime
... ... ... ....Question 2
Types of Databases (Marks: 10) After carefully studying the infographic, Dineo now needs to choose whether to use a relational database or a NoSQL database. She says that she needs to store the following information:
• For each launch, she needs to know who built the vehicle, where it was launched from and when. For crewed missions, she needs to know who the astronauts were that were on board.
• Each launch also has multimedia that should be included – a text description, photos, maybe even videos. Explain to her which type of database (relational or NoSQL) you would recommend, and why, for each of the following types of data.
Q.2.1 Launch data. (5)
Q.2.2 Multimedia related to the launch. (5)
Write a Java program that declares three variables of int type, q, d, and n, to
represent a set of number of coins a user must insert in order to buy a pack of cookie from the vending machine.
Use three nested while loops (must be while loops) to display all possible combinations of q, d, and n, as shown below.
You need to use an if statement within inner-most while loop to evaluate a Boolean condition based on the formula: 0.25q + 0.1d + 0.05n = 0.65.
Trekking Kit
Given an object
trekkingKit in the prefilled code and item item as an input, write a JS program to add the method isKitContains to the constructor function Trekking using the prototype.
The method
isKitContains checks whether the trekkingKit contains the given item.
Quick Tip
The Object.getOwnPropertyNames() method gives an array containing the properties of the object.
Input
The input will be a single line containing a string
item
Output
The output should be a single line containing a boolean value
Sample Input 1
ruckSackBag
Sample Output 1
true
Sample Input 2
surfboard
Sample Output 2
false
Area and Circumference of a Circle
Given radius
radius of a circle, write a JS constructor function with the methods getArea and getCircumference to calculate the area and circumference of the circle.
Note
The value of π = 3.14
Quick Tip
Use the formulae to calculate,
Area of circle = π * radius * radius
Circumference of circle = 2 * π * radius
Input
The input will be a single line containing a number radius
Output
The first line of output should contain the area of the circle
The second line of output should contain the circumference of the circle
Sample Input 1
7
Sample Output 1
153.86
43.96
Sample Input 2
25
Sample Output 2
1962.5
157