Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

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

  1. Write a C++ program that will prompt the user to give three filenames (two for input, e.g., in1.txt and in2.txt and one for output e.g., out.txt). The program should read one line from the first file and one line from the second file, compare the two lines and write to the third file the two lines, having the smaller at the end. Your program should perform some error checking regarding files.
  2. Note 1: You MUST use string objects from the C++ class string, NOT C-strings (array of characters). Note 2: Assume that the two input files (e.g., in1.txt and in2.txt) have the same number of lines, as below.

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

  • You can use the string method split()
  • You can use the array method map()

Input

  • The first line of input contains a string inputString
  • The second line of input contains a string separator
  • The third line of input contains a string replaceString

Output

  • The output should be a single line containing the strings separated by a space

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

myArray, write a JS program to check whether each value of the array is a string or not using the array method every().Input

  • The input will be a single line containing an array myArray

Output

  • The output should be a single line containing a boolean value

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


LATEST TUTORIALS
APPROVED BY CLIENTS