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 & Filtering

Consider an abstract class Animal having

A datamember “Name”

• A datamember “Zoo”

• A single function named show()

A class named Birds inherits Animal class and adds fields representing

• A bool type variable flying

• Override function named show() to display values of its all attributes

A class named Reptiles inherits BOOK class and adds fields representing

• Length

• Override function named show() to display values of its all attributes

Write a main() function that instantiates objects of derived classes to access respective show() function using dynamic binding


Write a program to carry out the following:

 To read a text file “TRIAL.TXT” consisting of a maximum of 50 lines of text, 

each line with a maximum of 80 characters.

 Count and display the number of words contained in the file.

 Display the total number of four letter words in the text file.

Assume that the end of a word may be a space, comma or a full-stop followed by one 

or more spaces or a newline character.


Write a program to carry out the following:

(a) Read a text file ‘INPUT.TXT’

(b) Print each word in reverse order

Example,

Input: PAKISTAN IS MY COUNTRY

Output: NATSIKAP SI YM YRTNUOC

Assume that each word length is maximum of 10 characters and each word is

separated by newline/blank characters.


Write a program to add the contents of one file at the end of another. 


Cite a situation in which you can apply the knowledge of creating modular jack cable


Max Contiguous Subarray input 2 -4 5 -1 2 -3


Parallelogram

Write a program to print a parallelogram pattern with

* characters. The size N represents the length (the number of * characters in each line) & breadth (the number of lines) of the parallelogram.The slope of the parallelogram

T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.Input

The input contains an integer

N.Output

The output should have

N lines. Each line should have spaces followed by N number of * characters as mentioned above.Explanation

Given

N = 3 and T = 2.Each line should have

3 star(*) characters. The last line should have 0 spaces at the beginning. Each line has 2 extra space characters when compared to its next line.

Sample Input 1

2 2

Sample Output 1

**

**

Sample Input 2

3 2

Sample Output 2

***

***

***


Leaders

You are given a list(

A) of integers. An element is a leader if it is greater than all the elements to its right side. And the rightmost element is always a leader.Write a program to print all the leaders in the list by maintaining their relative order.

Input

The input contains space-separated integers denoting the elements of the list

A.Output

The output should have the numbers in

A that are leaders.Explanation

Given

A = [4, 5, 1, 3, 2].The number

5 has no numbers that are greater than itself to its right side. The number 3 has no numbers that are greater than itself to its right side. The last number 2 is always a leader.So the leaders are

5 3 2.

Sample Input 1

4 5 1 3 2

Sample Output 1

5 3 2

Sample Input 2

9 8 10 12

Sample Output 2

12


Minimum Platforms

You are given arrival and departure times of all trains that reach a railway station. Find the minimum number of platforms required for the railway station so that no train is kept wait

Input

The first line contains space-separated integers that represent the arrival time of the trains.

The second line contains space-separated integers represent the corresponding end time of the trains.

Output

The output should have an integer that represents the number of platforms needed to arrange the commute of all the trains.

Explanation: The arrival times of 5 trains are

0900 0940 0950 1100 1500. The departure times of 5 trains are 0910 1200 1120 1130 1900.The first platform will be used to run the trains that arrive at

0900 0940 1500. The second platform will be used to run the trains that arrive at 0950.

Sample Input 1

0900 1100 1235

1000 1200 1240

Sample Output 1

1

Sample Input 2

0900 0940 0950 1100 1500

0910 1200 1120 1130 1900

Sample Output 2

3


Check Anagrams

For a given pair of words check if they are anagrams. Print

YES if they are anagrams, or else print NO.Two words are anagrams if one word can be obtained by the rearrangement of the characters in another word.

INPUT: The first line of the input contains an integer

N. Each of the next N lines contains two words separated by space.

OUTPUT: The output should have the status of each of the

N pairs that are given in the input.All the statuses are separated by space.

Explanation

Given pairs

dew wed

race care

In the word

dew, characters can be rearranged in the reverse order to get the word wed.So both the words are anagrams. The status of this pair is YES.

From the word race, when the characters r and c are swapped we will get the word care. So both the words are anagrams. The status of this pair is

YES.

Sample Input 1

2

dew wed

race care

Sample Output 1

YES YES

Sample Input 2

3

part trap

car air

some sum

Sample Output 2

YES NO NO


LATEST TUTORIALS
APPROVED BY CLIENTS