Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

18101.

Explain the Structure of a C++ program (with an example)

Answer»

#include

// main()

int main()

{

cout<< “Hello World”; // prints Hello World

return 0;

}

The various parts of the above program:

  • Headers, which contain information that is either necessary or useful to the program. For this program, the header is needed.
  • The next line // main() is where the program execution begins. It is a single-line comment available in C++. Single-line comments begin with // and stop at the end of the line.
  • The line int main() is the main function where program execution begins.
  • The pair of {} indicates the body of the main function. 
  • The next line cout<< “Hello World.”; causes the message “Hello World” to be displayed on the screen.
  • The next line return 0; terminates main() function and causes it to return the value 0 to the calling process.
18102.

Mention any two functions of stdio.h.

Answer»

Printf() and scanf() are the two functions of stdio.h.

18103.

What is called function?

Answer»

A called function is a function which is called from the calling function.

18104.

Mention any two functions of stdlib.h.

Answer»

Atoi() and itoa() are the two functions for stdlib.h

18105.

What is a linear data structure?

Answer»

The data elements are arranged in a sequential manner is called a linear data structure.

18106.

Define modifiers.

Answer»

The modifiers change the meanings of the predefined built-in data types and expand them to a much larger set.

18107.

What is the non-linear data structure?

Answer»

The data elements that are arranged non-sequentially is called non-linear data structure.

18108.

What are default arguments?

Answer»

While defining a function, one can specify a default value for each of the arguments is called default arguments.

18109.

What is the use of default arguments?

Answer»

The default value will be used if the corresponding argument is left blank when calling the function.

18110.

Mention the use of default arguments.

Answer»

The default arguments are useful in a function where some arguments always have the same value.

18111.

Give an example for manipulator.

Answer»

endl is a manipulator.

18112.

Mention any one advantage of user-defined function.

Answer»

Code Reusability:

Writing the same sequence of code at two or more locations in the program can be avoided with the use of functions and universal use feature reduces rewriting of repetitive codes.

18113.

What are manipulators?

Answer»

A manipulator is a C++ is used to control the formatting of output and/or input values.

18114.

Which documents helps in programme maintenance ?

Answer»

internal documentation

18115.

Explain program maintenance with reference to organization.

Answer»

Program maintenance is an important duty of programmers. It involves all steps from problem definition to program preparation. In certain organizations, programmers can do nothing but maintain the programs. 

At the initial stage of computerization, an organization’s programming effort mostly goes into the development of new applications. As the number of installed programs grows, the programming effort shifts from program development to program maintenance, in fact, in many organizations, more than half of the programming effort is on program maintenance. An estimate shows that the cost of program maintenance is twice larger than that of initial development.

18116.

Explain documentation.

Answer»

All programs need not be short and simple. Complex programs can be better understood if additional information is provided. Documentation is a method of providing useful information about a program. It consists of written descriptions, specification, and development of the program.

18117.

Explain types of comments.

Answer»

There are two types of comments in a C+ + program; single line comment and multi-line comment. Single line comment begins with the double slash (/ /) and ends in the same line. We can write a program statement and a comment in the same line. Whatever written after the / / is ignored by the compiler.

18118.

What is run-time error, logical error and syntax error?

Answer»

Syntax error: The errors which are traced by the compiler during compilation, due to wrong grammar for the language used in the program, are called syntax errors.

For example, cin<<a; // instead of extraction operator insertion operator is used.

Runtime Error: The errors encountered during execution of the program, due to unexpected input or output are called run-time error.

For example – a=n/0; // division by zero

Logical Error: These errors are encountered when the program does not give the desired output, due to a wrong logic of the program. 

For example : remainder = a+b// instead of using % operator + operator is used.

18119.

Define syntax error.

Answer»

The grammatical rules of a language are referred to as syntax of that language. If we do not strictly follow the syntax of programming language at the time of writing a program, syntax errors are bound to occur.

18120.

Write the factors on which documentation depend.

Answer»

1. A program must have meaningful constant and variable names.

2. A program should include specification of the problem.

3. The initial lines of comment should contain the programmer’s name, date, the brief description of the problem, and the purpose of the program.

4. Other comments include the input by form and type, output by form and type, data structures used, main function and other functions used, and assumptions.

5. The purpose of every function and their inter-relationships must be described with comments.

6. Comments are to be inserted in the program wherever necessary for clarity. The purpose of such comments is not to tell how or why something is done, but what is being done.

18121.

Explain GETS() and PUTS() function with example.

Answer»

GETS( ): In ‘C’ scanf( ) is not capable of receiving a multiword string, therefore, names such as “Rajeev Sharma” would be unacceptable. The function collects a string of characters terminated by a new line, the standard input.

PUTS(): The function puts() can display only one string at a time. Puts copies the nullterminated string to the standard output. Also on display a string, unlike printf(), puts() places the cursor on the next line.

Example:

void main()
{
char name [20];
printf (“enter your name");
gets (name);
puts (“Good Morning !”);
puts (name);
}

Output:

Enter your name, Rajeev Sharma

Good Morning

Rajeev Sharma.

18122.

Which header file is used for sesmf () and print ()?(a) stdio.h(b) conio.h(c) math.h(d) Both (a) and (b)

Answer»

Correct option is (b) conio.h

18123.

% is used for:(a) String data type(b) Character data type(c) Numeric data type(d) Float data type

Answer»

Correct option is (a) String data type

18124.

What do you know about string function? Explain three-string functions with suitable examples.OrWhat is a string? Explain two string functions of your choice.

Answer»

String Functions. String functions are those functions which  handle string data. ‘C’ language uses a large set of useful string handling library functions. Three string functions are:

1. STRCPY( ): This function copies the contents of one string into another. The base addresses of the source and target strings should be supplied to this function.
Example:

void main()
{
char src[ ] = “Rajeev”;
char tgt[20];
strcpy (tgt, src);
printf (“Source string = %s”, src);
printf (“Target string = %s”, tgt);
}
Output:
Source string = Rajeev
Target string = Rajeev

2. STRLWR(): This function converts upper case (A to Z) string to all lower case (a to z).
Example:

void main()
{
char STR[ ] = “RAJEEV”;
printf (“Upper case = %s”, STR);
strlwr(STR);
printf(“lower case = %s”, STR);
}
Output:
Upper case = RAJEEV
Lower case = rajeev

3. STRUPR( ): This function converts lower case (a to z) string to upper case (A to Z) string:
Example:

void main()
{
char str[ ] = “rajeev”;
prinft (“lower case = %S”, str);
strupr (str);
printf (“upper case = %S”, str);
}

Output:

Lower case = rajeev

Upper case = RAJEEV

18125.

Which of the following is not a looping statement?(a) for(b) if(c) while(d) do-while

Answer»

Correct option is (b) if

18126.

The process of appending one string at the end of smother string is known as ………..

Answer»

Concatenation.

18127.

In ‘C’ language a string is terminated with what?

Answer»

In ‘C’ language a string is terminated by null character or ‘10’.

18128.

Answer the questions by choosing the most appropriate answer from the options given.i. The people of Father Gilligan’s parish were ___.a) toiling in the field b) suffering from an epidemic c) celebrating Easter d) nodding their chairsii. The old priest was _____.a) energetic b) wearyc) freshd) angryiii. Mavrone means _____. a) My dear one b) An expression of sorrow c) God bless you d) God be with youiv. Father Gilligan awoke with a start, realising that he had not _____.a) done his duty b) roused his horse c) finished his homework d) said his prayersv. The word ‘flock’ in the context of the poem means: a) a flock of sheep b) sparrows c) stars in the sky d) people in the parishvi. Who is ‘wrapped in purple robes’? a) Father Gilligan b) The stars c) God d) Sparrowsvii. The expression ‘green sods’ refers to a) graves covered over by green grass b) the stars in the sky c) the people in the parish d) God’s angelsviii. What is referred to as ‘moth-hour of eve’? a) dawn b) noon c) evening d) the night of stars

Answer»

i) b. suffering from an epidemic. 

ii) b. weary

iii) b. An expression of sorrow 

iv) a. done his duty. 

v) d. the people of the parish 

vi) c. God 

vii) a. graves covered over by green grass 

viii) c. evening

18129.

What do you understand about the character of Fr Gilligan from the words ‘Had pity on the least of things’?

Answer»

It shows Fr. Gilligan was very humble. He considers himself the least of things, an unimportant being. But God had pity on him and sent his angel to do his duties.

18130.

Read the poem again and pick out an instance of simile used in the poem.

Answer»

Simile – as merry as a bird.

18131.

‘He knelt him at that word.’ Why?

Answer»

He knew that God had done a miracle to send an angel to do the work Fr. Gilligan must have done.

18132.

‘He who hath made the night of stars/For souls who tire and bleed’. What do these lines mean?

Answer»

They mean that God made the beautiful night of stars so that the tired and suffering people can find some rest and comfort.

18133.

How did God save Father Gilligan from damnation?

Answer»

God saved Fr Gilligan from damnation by sending an angel to give the sacraments to the dying man. If the man had died without getting forgiveness for his sins, Fr. Gilligan would have been damned for neglecting his priestly duties.

18134.

Why is the sick man’s wife surprised to see Father Gilligan?

Answer»

The sick man’s wife was surprised to see Father Gilligan because she thought he had come earlier and given the last sacraments to her dying husband. In fact it was an angel that came earlier and not Father Gilligan. She did not know that.

18135.

Why did another man send for Father Gilligan? Why is the man referred to as ‘poor’?

Answer»

Father Gilligan was needed to give the sick man his sacrament of ‘anointing the sick’. He is referred to as poor because he is poor in soul. A person with sin is supposed be poor in soul as he will not get heaven if he dies in a state of sin.

18136.

Why were his flock either in bed or lying under green sod?

Answer»

His flock were either in bed or lying under green sod because an epidemic had hit the parish. People were sick and dying.

18137.

What is the significance of the word ‘flock’?

Answer»

Flock is the collective noun meaning a collection of sheep. In Christianity, the parish priest is supposed to be the shepherd and the parishioners are the flock.

18138.

Read the following sentences from the story.He was by profession, a solicitorI was a young doctor at the doctor the time.It was a sergeant of sergeant police.The words given in bold refer to various professions.The names of different professions are given on the left column and the details are given on the right.Match the items by drawing lines.Accountanta person who works with electric circuits.Astronomera person who makes things from wood.Botanista person who cuts your hair or gives it a new style.Carpentera person who puts out fire.Dentista person who works with money and accounts.Electriciana person who studies plants.Firefightera person who can fix problems of your teeth.Hairdressera person who studies stars and the universe.

Answer»
Accountantworks with money and accounts.
Astronomerstudies stars and the universe.
Botaniststudies plants.
Carpentermakes things from wood.
Dentistfixes problem with your teeth.
Electricianworks with electrical circuits.
Fire-fighterputs out fire
Hairdressercuts your hair and gives it a new style.
18139.

“Utterly friendless, he had fallen victim to the loose society of the streets…” What does the author mean by this statement?

Answer»

The young man was without friends and slowly he got into bad company. He started living a life beyond his means. He began to bet on horses and it ruined him.

18140.

“I found liking him instinctively.” Why?

Answer»

I found liking him instinctively because there was much enthusiasm in his voice, manner and his personality

18141.

Words are divided into two classes – Closed Word Classes and Open Word Classes. When we say Closed Word Classes, we mean those classes to which no more new words will be added. Thus Determiners, pronouns, prepositions and conjunctions are Closed Word Classes.Open Words classes are Nouns, verbs, adjectives and adverbs. New words are added to these categories. That is why they are called Open Word Classes.Here is a passage from the text. It contains both Closed Word Classes and Open Word Classes. Pick out the words and decide to which category they belong.On the second day, out from New York, while making the round of the promenade deck, I suddenly became aware that one of the passengers was watching me closely following me with his gaze every time I passed.I wanted to rest, to avoid the tedium of casual and importunate shipboard contacts. I gave no sign of having noticed the man.

Answer»

Closed Word Classes

  • Determiner : the, one, every
  • Pronoun : I, me, his
  • Preposition : On, out, from, of, with, to
  • Conjunction : while, that, and

Open Word Classes

  • Noun : day, New York, promenade, deck, passengers, gaze, time, tedium, shipboard, contacts, sign, man
  • Verb : making, became, was watching, following, passed, wanted, rest, avoid, gave, having, noticed
  • Adjective : round, second, aware, casual, importunate, no Adverb: suddenly, closely
18142.

I was awakened by a loud banging on the door. ’Who was banging on the door’? Why?

Answer»

A sergeant of police was banging on the door. There was a case of attempted suicide and he had come to call Cronin as he is a doctor.

18143.

What did Cronin mean by the expression ‘the veils parted’?

Answer»

The man told him of the incident 25 years ago, when Cronin had helped him. Now Cronin remembered everything. The veils parted. Now he knew why the man was keen on talking to him.

18144.

Fill in the following passage using appropriate words given below: (maladjusted, paltry, disarming, go on, awkwardness, genuine, importunate, given up, tedium, apparently)

Answer»

The tedium of life in old age homes has been pointed out by many. The awkwardness old people face there is mainly out of the importunate curiosity of the visitors who come there. Many of the old people are maladjusted because of the long and solitary lives they have to lead there. Apparently there are no genuine cases of abandoned parents because of the financial conditions of the family.

Most of them are given up by their wealthy children. We have to go on enlightening our youths against the tendency to fly away from their parents. The paltry sum they send ¡s nothing if they really know the value of the disarming smiles that bloom on the faces of their parents when they are properly cared for in their old age.

18145.

Have you come across any person with importunate behaviour? How did ypu feel about it? Describe your experience.

Answer»

Yes, I have come across a person with importunate behaviour. I felt very bad about it. This person sells lottery tickets. He goes on pestering me to buy tickets from him. I feel very bad as I have to repeatedly tell him I don’t need any lottery ticket.

18146.

What did Cronin learn about the man after questioning him further?

Answer»

He learned that the man and his wife had been active for the past 15 years in the field of youth welfare. He was a solicitor by profession but in addition to his practice in courts, he found time to act as the director of a charitable organization devoted to the care of boys and. girls who were punished by the courts.

18147.

Read the following sentences.Listening to a single story is the refusal of truths.Applauds of the audience energise the athletes.Racism had deeply affected the life of the African Americans.Freedom is the birthright of an individual.Nightingales have a musical voice.Climate changes threaten the life on earth.These paintings are very creative.Each of us should be a protector of nature.The argument against fossil fuel consumption is stronger nowadays.He seemed affected by a troubled, rather touching diffidence.Education will enlighten the minds of people.He went on with the same awkwardness. He found time to act as director of a charitable organisation.Pick out the words highlighted in these sentences and complete the table.WordRoot wordsuffixesRefusalRefuseal………………………………………………………………………………………………………………………

Answer»
WordRoot wordSuffix
refusalrefuseal
energiseenergyise
racismraceism
freedomfreedom
musicalmusical
threatenthreat en
creativecreateive
protectorprotector
argumentarguement
diffidencediffidentce
enlightenlighten
awkwardnessawkwardness
organisationorganiseation
18148.

How did the couple help derelict adolescents to lead normal lives?

Answer»

They took derelict adolescents from the juvenile courts and placed them in a healthy environment. They healed them in mind and body and sent them back into the world. They were given training in some handi craft so that they could live as worthy citizens.

18149.

Why was the narrator not interested in the man who was watching him?

Answer»

The narrator was not interested in the man who was watching him because he wanted to rest and avoid strangers who would bore him with unnecessary questions.

18150.

From a state of loss and despair, John came to a life of success and joy. He intervened wholeheartedly to bring about a change in the miserable life of many young men. What helped him do so? What lesson do we learn from the eventful life of John? Discuss. In the light of the discussion, prepare a speech on the topic. “Self help is the best help.”

Answer»

My dear Principal, teachers and students, Today I am going to talk on the topic “Self help is the best help.” We all heard about the story of John. John’s parents were dead. His uncle helped him to get the job of a clerk in a London lawyer’s office. He had no friends and he fell into bad company. He started enjoying pleasures beyond his means. He started betting on horses. Soon he lost all his savings. In an effort to get money he stole some money from his office safe to make a final bet. But again he lost. He now wanted to commit suicide. He went to the room and turned on the gas.

A doctor was called in to attend to him as he was found unconscious. There was also a policeman as well as the land lady of John. The doctor soon revived him. John told them his story. The doctor, the policeman and the landlady felt pity for him and they agreed to help him. The doctor gave him the money to replace what he took from the office safe. The policeman would not report against John. The landlady would give him a month’s free board.

John changed completely. He worked hard and he became a success in life. Now he and his wife are helping children with problems to settle in life. John learned to help himself and others. Self help is the best. If you are determined to succeed, no one can stop you. “Where there is a will, there is a way.” Thank you for listening.