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

1.Write a program to find largest number among three number. Also, design flowchart of the program. 

2. Write a C Program to Calculate the Power of a Number. [Hint Use math.h library and pow() function ]

Write a regular expression for the following languages, over sigma=(a,b) All strings that do not end with aa.All strings that contain an even number of b’s. All strings which do not contain the substring ba.


Construct NFA for the regular Expression R=(a+b) ∗abb


Draw DFAs for the regular expression R= a ∗ (ba∗ ba∗ ) ∗


The Pythagorean theorem states that the sun of the squares of the sides of a right triangle is equal to the square of the hypotenuse. Given two positive integers, m and n, where m>n, a Pythagorean triple can be generated by the following formulas:

Side 1= m2 - n2

Side 2 = 2mn

Hypotenuse = m2 + n2

Write a program in visual basics that reads in values for m and n and prints the values of the Pythagorean triple generated by these formulas


Product of values in the Sub-array(s)


Given an array

nestedArray of arrays, write a JS program to multiply the values in the sub-array if at least one of its values is even else return zero.


Quick Tip

You can use array methods map(), some() and reduce().

Input

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

Output

  • The output should be a single line containing an array

Constraints

  • Each value in the array must be a number


Sample Input 1

[ [ 12, 1, 2, 4, 1 ], [ 18, 20, 30, 45 ], [ 49, 11, 13, 21 ] ]


Sample Output 1

[ 96, 486000, 0 ]


Sample Input 2

[ [ 0, 1 ], [ 1, 3, 4 ] ]


Sample Output 2

[ 0, 12 ]



i want code in between write code here


"use strict";


process.stdin.resume();

process.stdin.setEncoding("utf-8");


let inputString = "";

let currentLine = 0;


process.stdin.on("data", (inputStdin) => {

 inputString += inputStdin;

});


process.stdin.on("end", (_) => {

 inputString = inputString.trim().split("\n").map((str) => str.trim());

 main();

});


function readLine() {

 return inputString[currentLine++];

}


/* Please do not modify anything above this line */


function main() {

 const nestedArray = JSON.parse(readLine());


 /* Write your code here */

}



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


i need code in between write code here


"use strict";


process.stdin.resume();

process.stdin.setEncoding("utf-8");


let inputString = "";

let currentLine = 0;


process.stdin.on("data", (inputStdin) => {

 inputString += inputStdin;

});


process.stdin.on("end", (_) => {

 inputString = inputString.trim().split("\n").map((str) => str.trim());

 main();

});


function readLine() {

 return inputString[currentLine++];

}


/* Please do not modify anything above this line */


function main() {

 const inputString = readLine();

 const separator = readLine();

 const replaceString = readLine();

  

 /* Write your code here */

}



Fetch the top 10 videos having more number of views, along with the channel details.

Note:

Sort the output in the descending order of no_of_views, and then in the ascending order of channel_name.

Expected Output Format:

video_nameno_of_viewschannel_name

TABLE CHANNEL:-

       channel_id	    name	      owner_id	created_datetime
          350	    Motivation grid	    1011	2014-10-05 17:32
          351	      Marvel	        1011	2014-10-05 17:32
          352	      Disney	        1012	2015-09-10 15:32
          353	       Tedx	            1013	2016-10-05 17:32
          354	       ETV	            1011	2012-08-17 19:32
          355	       Maa	            1012	2007-03-07 11:32
          356       PewDiePie	        1012	2004-10-05 11:32
          357	   VanossGaming	        1013	2005-09-10 15:32
          358	    Markiplier	        1013	2014-10-05 08:32
          359	      Ninja	            1012	2016-08-17 17:32
          360	      WWE	            1011	2016-09-10 12:32
          361	   Tech savvy	        1011	2016-09-10 12:32
          362	  Marques Brownlee.	    1012	2018-09-10 12:32
          363	    The Verge	        1013	2015-09-10 12:32

TABLE VIDEO:-

video_id	name	duration_in_secs	published_datetime	no_of_views	channel_id
1000	 Getting My 
     Driver's License      3652	          2011-12-05 19:00	    10619	   367
     | Lele Pons	      
1001	Apple iPhone 
     X Review: The         4556	          2021-01-19 20:12	    140012	   362
        Best Yet!	       
1002	Victoria Beckham
       Gives Strangers 
       Fashion Advice for   836	          2021-01-19 20:12	     75609	    353
     $2 in Central Park 
      | Vanity Fair	
1003	4 Reasons I Don't
      Like Thanksgiving     1751	      2017-05-05 17:32	    279351	    350
        || Mayim Bialik	
1004	Maroon 5 - What
          Lovers Do         3186	      2018-02-17 19:32	     94945	    354
       (Live On The Ellen 
      DeGeneres Show/2017)	
1005	Alicia Keys - When
       You Were Gone	    3737	      2018-04-10 12:32	     35526	    361
1006	U.S. Navy Three 
      Carrier Formation in  3538	      2021-01-19 20:12	     180973	    362
      Western Pacific Ocean	
1007	DIY - Simon's Cat  
     | NEW BLACK & WHITE!	1365	      2012-09-07 11:32	     106271	    355
1008  You, but in emojis. 
         (YIAY #375)	    3874	      2021-01-19 20:12	     16469	    352
1009	100 People Hold 
       Their Breath for as 
         Long as They Can	 2885	      2015-05-17 19:32	     272102	    354
1010   Luke Bryan - Hooked 
        On It (Audio)	     2106	      2016-02-10 12:32	     184471	    366

EXPECTED OUTPUT:-

video_name	no_of_views	channel_name
    ...	         ...	    ...

String Starts or Ends with given String

Given an array

stringsArray of strings, and startString, endString as inputs, write a JS program to filter the strings in stringsArray starting with startString or ending with endString.

Quick Tip

You can use the array method filter() and logical operator OR ( || ).


Input

  • The first line of input contains a string stringsArray
  • The second line of input contains a string startString
  • The third line of input contains a number endString

Output

  • The output should be a single line containing an array of filtered strings


Sample Input 1

['teacher', 'friend', 'cricket', 'farmer', 'rose', 'talent', 'trainer']

t

r


Sample Output 1

[ 'teacher', 'farmer', 'talent', 'trainer' ]


Sample Input 2

['dream', 'player', 'read', 'write', 'trend']

p

d


Sample Output 2

[ 'player', 'read', 'trend' ]



i want code in between write code here



"use strict";


process.stdin.resume();

process.stdin.setEncoding("utf-8");


let inputString = "";

let currentLine = 0;


process.stdin.on("data", (inputStdin) => {

 inputString += inputStdin;

});


process.stdin.on("end", (_) => {

 inputString = inputString.trim().split("\n").map((str) => str.trim());

 main();

});


function readLine() {

 return inputString[currentLine++];

}


/* Please do not modify anything above this line */


function main() {

 const stringsArray = JSON.parse(readLine().replace(/'/g, '"'));

 const startString = readLine();

 const endString = readLine();


 /* Write your code here */

}





Create a program using a one-dimensional array that accepts five input values from the keyboard. Then it should also accept a number to search. This number is to be searched if it is among the five input values. If it is found, display the message “Searched number is found!”, otherwise display “Search number is lost!”.


LATEST TUTORIALS
APPROVED BY CLIENTS