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

Pattern Printing


Given the number of rows N, write a program to print the hallow diamond pattern similar to the pattern shown below.


    A
   B B
  C   C
 D     D
E       E
 D     D
  C   C
   B B
    A


Input

The input will be a single line containing a positive integer (N).


Output

The output should be (2*N - 1) rows and (2*N - 1) columns containing the alphabet characters in the hollow diamond pattern.


Explanation

For example, if the given number is 5, the pattern should contain 9 rows and 9 columns as shown below.


    A
   B B
  C   C
 D     D
E       E
 D     D
  C   C
   B B
    A


NOTE:

NO SPACES ON LEFT SIDE FOR DIAMOND


CCBPLogin

The goal of this coding exam is to quickly get you off the ground with CCBP Login Page

image:

https://assets.ccbp.in/frontend/content/dynamic-webapps/ccbp-login-op.gif

It should pass:

When the HTML button element with attribute type submit is clicked,if the values of the HTML input elements with ids name and password are not empty then text content in the HTML paragraph element with id resultMsg should be displayed as "Login Success".


When the HTML btn element with attribute type submit is clicked,if the values of the HTML input elements with ids name and password are empty then text content in the HTML paragraph element with id resultMsg should be displayed as "Fill in the required details".


When the submit is clicked and the value of the HTML input elements with id name is empty and password is not empty then the text content in the HTML paragraph element with id nameErrMsg and resultMsg should have an error message and "Fill in the required details" respectively.





1.Make a Console App with a class that encapsulates the following information about a bird: English name, Latin name, and Date last seen. Allows the user to fill in the details about a bird. The data is saved in a Bird object, which is then displayed to the user. 2.In the program, create a superclass called Animal and update class Bird to inherit from it. Create a new class named Butterfly that allows the user to collect butterfly data. 3.Display the percentage of birds and butterflies in the app when displaying the birds and butterflies. When there are no entries in the app yet, use exception handling to handle the divide by zero. 4.Create an interface called ISighting with a single method called displaySighting. Implement the interface in Animal but leave the displaySighting method abstract. Implement the displaySighting method in both the Bird & Butterfly classes to display all the information known about the animal to the console.Update app so that the user can choose to add a bird or a butterfly.


Riya took part in a maths quiz competition. To win the prize money she has to solve a tricky question at the end.For a given list of integers, write a program where all the integers in a given index range to be added.

She will be given M multiple ranges, where she should print the sum of numbers for each corresponding range.


Note: The limits in the range are both inclusive.


Input

The first line f input is space-separated integers.

The second line of input is a positive integer M denoting the number of index ranges.

The next M lines contain two space-separated integers of the range.


Output

The output should be M lines.

Each line contains an integer that represents the sum for the corresponding ranges.


Sample Input1

1 3 4 5 6

5

3 5

Sample Output1

12



[Please test the sample test cases and send the screenshots].


Random Activity


The goal of this coding exam is to quickly get you off the ground with the DOM Manipulations.


Refer to the below image.


https://assets.ccbp.in/frontend/content/dynamic-webapps/random-activity-output.gif


Achieve the given functionality using JS.


Make a HTTP request(GET method) using fetch with the URL

https://apis.ccbp.in/random-activity to get a random activity.

Add

loading status with Bootstrap component spinner while making an HTTP request

It should pass:

JS code implementation should use the .classList.add and .classList.remove.


JS code implementation should use the addEventListener for click event.


When the HTML button element with the id getActivityBtn is clicked, a GET request has to be sent to the given URL. and set HTTP response value in the HTML paragraph element with id activityName, activityType and HTML Img element with id activityImg should change according to the response.




The program simply calculates the pay(hourlyrate*normal hours)




Output displayed



Enter hourly rate : 21,50



Enter normal hours worked : 2




Hourly rate : R21,50. Normal hours :2



PAY : R43,00

Mode


given a list of integers,write a program to print the mode.


mode - the most common value in the list. if multiple elements with same frequency are present, print all values with same frequency in increasing order.




input


the input will be a single line of containing space-separated integers.




output


the third line of output should contain the mode.


see sample input/output for the output format




explanation 


for example, if the given list of integers are 

2 6 3 1 8 12 2 9 10 3 4

the average of all the numbers is 4.67.

after sorting the array,

1 2 2 3 3 4 6 8 9 10 12

as 2 and 3 are having the same frequency , the mode will be 2 3.

so the output should be

Mode: 2 3


sample input 1


2 6 3 1 8 12 2 9 10 3 4


sample output 1


Mode: 2 3


Mode

given a list of integers,write a program to print the mode.

mode - the most common value in the list. if multiple elements with same frequency are present, print all values with same frequency in increasing order.


input

the input will be a single line of containing space-separated integers.


output

the third line of output should contain the mode.

see sample input/output for the output format


explanation 


for example, if the given list of integers are 

2 4 5 6 7 8 2 4 5 2 3 8

the average of all the numbers is 4.67.

after sorting the array,

2 2 2 3 4 4 5 6 7 8 8

as 2 is most repeated number , the mode will be 2.

so the output should be

Mode: 2


sample input 1

2 4 5 6 7 8 2 4 5 2 3 8

sample output 1

Mode: 2



Write a program in C++take two matrix and compute their addition subtraction and multiplication. With output

Median


given a list of integers,write a program to print the mean,median and mode 

median - the mid point value in the sorted list.


input 

the input will be a single line of containing space-separated integers.


output

the second line of output should contain the median, round off the value to 2 decimal places.

median should be a float value when there are even number of elements, otherwise should be an integer value.

see sample input/output for the output format


explanation 


for example, if the given list of integers are 

2 6 3 8 12 2 9 10 3 4

the average of all the numbers is 4.67.

after sorting the array,

1 2 2 3 3 4 6 8 9 10 12

as the length of the list is an odd number, the median will be middle numbers in the sorted list.so the median will be 4

so the output should be


Median: 4


LATEST TUTORIALS
APPROVED BY CLIENTS