Explore topic-wise InterviewSolutions in Current Affairs.

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

1.

What are the different formats to create csv files?

Answer»

1. CSV file – data with default delimiter comma (,)

2. CSV file – data with Space at the beginning

3. CSV file – data with quotes

4. CSV file – data with custom Delimiters

2.

A variable name must start with:(a) An alphabet(b) A number(c) $ symbol(d) # sign

Answer»

Correct option is (a) An alphabet

3.

Function to check the time of the day.

Answer»

Function to check the time of the day:

time ( )

4.

Write all steps of program solving methodology.

Answer»

There are the following seven steps of program solving methodology: 

1. Problem Definition: Computer programs are written to solve problems posed by humankind. Prior to writing a program, one has to understand a description of the problem to solve. This description may be very precise or vague, but nevertheless, it is necessary /present. Once the programmer is sure of what the problem entails, he must write down a list of specifications. Specifications are precise definitions of what the program must do. 

2. Problem Analysis: In this step, the problem has to be fragmented into smaller and manageable parts. The original problem has to be analyzed and divided into a number of sub-problems as these sub-problems are easier to solve and their solutions would become the components of the final problem. Each sub-problem is divided into further smaller ones and this fragmentation has to be continued to achieve simple solutions. The use of modular programming is to get proper solution. 

3. Designing the Problem: Designing the problem can be expressed in the form of: 

(i) Algorithm 

(ii) Flowchart 

(i) Algorithm: An algorithm is a set of instructions that describe a method for solving a problem. It is normally given in the mixture of computer code and English Language. This is often called “Pseudocode”. 

(ii) Flowchart: The algorithm is represented in the form of a diagram with action boxes linked by lines showing the order in which they are executed. This is known as ‘the flow of control’. It is the diagrammatic representation of an algorithm. 

4. Coding: The process of translating the algorithm into the syntax of a given language is known as ‘coding’. Since algorithm cannot be executed directly by the computer, it has to be translated into a programming language. 

5. Program Testing and Debugging: Program testing means running the program, executing all its instructions and testing the logic by entering sample data in order to check the output. Debugging is the process of finding and correcting the errors in the program code. 

6. Documentation: The documentation includes the problem definition, design documents, a description of the test performed, a history of the program development and its different versions and a user’s manual. Such a manual is designed for a native user and illustrates the preparation of input data, running the program and obtaining and interpreting the results. 

7. Program Maintenance: It is not directly part of the original implementation process, but needs special emphasis. All activities that occur after a program operation are part of the program maintenance. Many large programs have a long lifespan that often exceeds the lifetime of the hardware they run on. Maintenance is an important part of the life cycle of a program.

5.

Explain logical error.

Answer»

A logic error is a defect in the program that causes it to produce an incorrect result, but one that is not so blatant as to be detectable as a runtime error. (A logic error in one part of the program might eventually trigger a runtime error in some other part of the program, but those are separate errors.) An example would be a function that is supposed to return the larger of its two arguments but in fact, returns the smaller: 

def larger(m, n): 

if (m > n): 

return n 

return m

6.

Write the alternate name of error.

Answer»

The alternate name of the error bugs.

7.

Explain run time error with example.

Answer»

Run-Time Errors: A program’s syntax may be correct- H may be compiled and linked successfully. But it may not be executed successfully because of run-time errors. Such errors are found at the time of executing the program. Let us consider the following program segment

n = 9;

while (n > 1)

{

n-1

m = m / (n -1);

}

When the value of n becomes 2, the expression a > 1 is true.

Hence, the statement n – decreases the value of n by 1. When the value of n is 1, The divisor is O’ which generates a run-time error. Run-time errors include finding the square root of a negative number, stack overflow, and null pointer assignment.

8.

Write any two characteristic of comments.

Answer»

Comments are not executed in a program. Since the compiler ignores comments, there will be no increase in the file size and execution time.

9.

Why do we use comments ?

Answer»

Comments help the reader to understand the programme easily.

10.

How many types of documentation are there ?

Answer»

(a) internal documentation

(b) external documentation

11.

What is debugging ?

Answer»

The process of correcting the error.

12.

What do you mean by running and debugging of programme.

Answer»

Running and Debugging Programs: Once a program has been written, it has to be tested for its correctness. During this process, we may find errors. In computer terminology, errors are known as bugs, and the process of correcting the errors is known as debugging.

13.

Explain programme maintenance.

Answer»

Changes in requirements force to modify existing programs. Program maintenance is the modification of a program to take care of changing requirements or any errors found after the program is put to use.

14.

रिकर्सिव फंक्शन को उदाहरण सहित समझाइए।

Answer»

जब कोई फंक्शन अपनी परिभाषा में स्वयं को ही कॉल करता है, तो ऐसी स्थिति को रिकर्सन कहा जाता है और ऐसे फंक्शन को रिकर्सिव फंक्शन कहा जाता है।

उदाहरण

#include<iostream.h>
int fibonacci(int i)
{
if (i = 0)
{
return 0;
}
if(i=1)
{
return 1;
}
return fibonacci (i-1) + fibonacci (i-2);
}
void main( )
int i; for ( i = 0; i < 10; i++)
{
cout<<“\n”<<fibonacci(i);
}
}

आउटपुट
o
1
1
2
3
5
8
13
21
34

15.

strcat ( ) व strcpy ( ) फंक्शनों को उदाहरण सहित समझाइए। 

Answer»

strcat ( ) यह फंक्शन दो स्ट्रिगों को जोड़ने के लिए प्रयोग किया जाता है। strcpy ( ) इस फंक्शन का प्रयोग एक स्ट्रिग को दूसरी स्ट्रिग में कॉपी करने के लिए किया जाता है।

उदाहरण

#include<iostream.h>
#include<string.h>
#include<conio.h>
void main( )
{
char str1 [10] = “Hello”;
char str2[10]= “World”;
char str3[10];
strcpy (str3, str1); //copies strl into str3
cout<<“strcpy(str3, str1):”<<str3< <end1;
strcat (str1, str2);
//concatenation str1 and str2 into str1
cout<<“strcat(stri, str2):”
<<str1<<end1;
getch ( );
}

आउटपुट
strepy(str3, str1): Hello
streat(str1, str2): HelloWorld

16.

C++ फंक्शन के केवल उस प्रोग्राम खण्ड को लिखें, जिसका नाम औसत है और जो प्रथम 20 अंकों का योग व औसत ‘do-while’ लूप का प्रयोग करके निकालिए।

Answer»

Average ( )
int sum=0, i=1, avg;
do
{
sum=sum+i;
i++;
}
while (i<=20) ;
cout<<“The sum is”<<sum<<end1;
avg = sum/20;
cout<<“The average is” <<avg;
}

17.

स्टैटिक वैरिएबल किस प्रकार अन्य वैरिएबल से भिन्न है? उदाहरण सहित समझाइए।

Answer»

किसी वैरिएबल के प्रारम्भ में यदि static की-वर्ड लगा होता है, तो उसे स्टैटिक वैरिएबल कहते हैं। स्टैटिक वैरिएबल केवल एक बार डिक्लेयर किए जाते हैं तथा उनकी वैल्यू स्थिर रहती है।

उदाहरण:

स्टैटिक वैरिएबल द्वारा वैल्यू प्रिण्ट करना।
#include<iostream.h>
#include<conio.h>
void counter( )
{
static int count=0;
cout<<count++;
}
int main()
{
clrscr( );
for (int i=0; i<5;i++)
{
counter ( );
}
getch( );
}

आउटपुट
0  1  2  3  4

उदाहरण

बिना स्टैटिक वैरिएबल द्वारा वैल्यू प्रिण्ट करना।
#include<iostream.h>
#include<conio.h>
void counter( )
{
int count = 0;
cout<<count++;
}
int main( )
{
clrscr( ); for (int i=0; i<5; i++)
{
counter( );
}
getch( );
}

आउटपुट
0 0 0 0 0

18.

फंक्शन ओवरलोडिंग क्या है? उदाहरण सहित समझाइए। 

Answer»

फंक्शन ओवरलोडिंग का अर्थ है कि किसी एक फंक्शन नाम से विभिन्न परिस्थितियों में विभिन्न कार्य कराना, जिससे एक फंक्शन के कोड को पुनः नहीं लिखना पड़ता और समय की बचत होती है। इसका प्रयोग करके हम फंक्शन को समान नाम से किन्तु अलग-अलग argument list से डिक्लेयर तथा परिभाषित कर सकते हैं।

उदाहरण

#include<iostream.h>
#include<conio.h>
sum (int, int);
sum (float, float);
void main( )
{
int a, b;
float c, d;
sum (8, 6) ;
sum (2.2f, 3.5f);
getch( );
}
sum(int a, int b)
{
int s;
s = a+b;
cout<<“sum is “<<s<<end1;
}
sum (float c, float d)
{
float s1;
s1 = c + d;
cout<<“sum is “<<s1;
}

आउटपुट

sum is 14
sum is 5.7

19.

उदाहरण देकर फॉर्मल (Formal) व एक्चुअल (Actual) पैरामीटर्स को समझाइए। 

Answer»

फॉर्मल पैरामीटर जो पैरामीटर फंक्शन को परिभाषित करने में प्रयोग होते हैं, फॉर्मल पैरामीटर कहलाते हैं।
एक्चुअल पैरामीटर जो पैरामीटर फंक्शन कॉल करने में प्रयोग किए जाते हैं, एक्चुअल पैरामीटर कहलाते हैं।

उदाहरण

int square (int);
int main( )
{
int v, s = 5;
:
square (S);
:
int square (int a)
{
return a*a;
}
(S); एक्चुअल पैरामीटर
(int a)फॉर्मल पैरामीटर

20.

Wheat is grown in which districts of Rajasthan?

Answer»

Ganganagar, Hannumangarh, Alwar, Bharatpur, Jaipur, Kota, etc.

21.

What is the purpose of strcmp function?

Answer»

Strcmp function. This function compares two strings to find out whether they are the same or different. The string comparison starts with the first character in each string and continues with subsequent characters until the corresponding characters differ or until the end of the strings is reached. If the two strings are identical, strcmp () returns a value zero. If they are not, it returns the numeric difference between the ASCII values of the non-matching characters. Example:

void main ()
{
char str 1 [ ] = “Rajeev”;
char str 2 [ ] = “Sharma”;
int i, j, k;
i = strcmp(str l, “Rajeev”);
j = strcmp (str l, str 2);
k = strcmp (str l, “Rajeev Sharma”);
printf (“\n % d %d % d”, i, j, k);
}

Output: 0 – 1 – 32

22.

Maize is grown in which districts of Rajasthan?

Answer»

Kota, Bundi, Bara, Jhalawar, Udaipur, Dungarpur, Banswara, Chittor, Ajmer, Ganganagar and Hanumangarh.

23.

What are the strings?

Answer»

Strings: Like a group of integers can be stored in an integer array, similarly a group of characters can be stored in a character array. Strings are single-dimensional arrays of type char. In ‘C’ , a string is terminated by null character or ‘\0’. String constants are written in double-quotes.

For Example: **char name [ ] = {‘I’ , ‘N’ , ‘D’ , ‘T’ , ‘A’ , ‘\0’};

Each character in the array occupies one byte of memory and the last character is always ‘\0’.’\0′ is called null character. Note that ‘\0’ and ‘0’ are not the same. ASCII value of ‘\0’ is 0, whereas the ASCII value of ‘O’ is 48. Many string functions such as string length, string compare, string copy, string concatenate etc. are most commonly used functions.

24.

What do you understand by commercial crops?

Answer»

Those crops which utilized for commercial purposes or as raw materials in industries are called commercial crops or cash crops, e.g. sugarcane, cotton, jute, tobacco, oilseeds, etc.

25.

What do you understand by Narma?

Answer»

Narma is a type of cotton.

26.

Write a short note maize crop.

Answer»

Apart from being a foodgrain, this is an industrial crop which is used as raw material by industries which make starch and glucose. This is also used as fodder. After rice this is the second most important kharif crop in India. Maize was introduced in India in the 17th century by the Portuguese. Maize crop needs temperature between 12 to 35° Celsius and rainfall between 50 to 100 cm. This crop needs nitrogen- rich soil which is well drained. India’s maize production is 60% which comes from Andhra Pradesh (19.3%), Karnataka (16.78%), Rajasthan (10.38%) Uttar Pradesh (10%), Gujarat (7.0%), Madhya Pradesh and Punjab. In Rajasthan; maize is grown in Kota, Bundi, Bara, Jhalawar, Udaipur, Dungarpur, Banswara, Chittor, Ajmer, Ganganagar and Hanumangarh. India is the 10th largest producer of maize in the world. But this crop is not exported because of low production.

27.

Classify the crops on the basis of their usage.

Answer»

Crops can be classified into four types on the basis of their usage: 

1. Cereals 

2. Cash crops 

3. Plantation crops

4. Horticulture crops

28.

What do you mean by cash crops?

Answer»

Crop which is primarily grown to be sold in the market are called cash crops, e.g. tobacco, cotton, etc.

29.

What are the main cash crops in India? ‘

Answer»

Sugarcane, cotton, oilseeds, jute and tobacco.

30.

A ______________ can process data, images, audio, video and graphics.

Answer»

Correct Answer is  Computer

31.

Write the structure of a function.

Answer»

Function_type function_name (data-type arg 1, data-type arg 2, … data-type arg n)

{

variable declarations;

statement 1;

statement 2;

……..

statement n;

retum(expression);

}

32.

True or False:A computer can process data, images, audio, video, and graphics.

Answer»

Correct Answer is  True

33.

Explain any three properties of functions.

Answer»

1. It performs some well-defined task, which will be useful to other parts of the program.

2. The rest of the program doesn’t t have to know the details of how the function is implemented. This can make the rest of the program easier to think about.

3. One part of the program can be rewritten, to improve performance or add a new feature (or simply to fix a bug), without having to rewrite the rest of the program.

34.

What is the difference between in-built functions and user-defined functions?

Answer»

A programmer has to write a user-defined function, whereas in-built functions are available to a programmer in the standard ‘c++’ libraries. Due to this, the in-built functions are also known as library functions.

Eg: sqrt(), setw(), strlen( ), strcat(), etc.,

35.

What are selection statements?

Answer»

The selection statements are used to execute certain block of statements the evaluating the condition.

36.

What is meant by function definition?

Answer»

A function definition provides the actual body of the function with a name that you call it by, a list of zero or more arguments and it may give back a return value, of a particular type.

37.

What is meant by the compound statement?

Answer»

A compound statement is a grouping of statements enclosed between the pair of braces ({ }) in which each individual statement ends with a semi-colon.

38.

What are the different types of arguments?

Answer»

1. Actual arguments

2. Formal arguments.

39.

Give an example for sizeof operator.

Answer»

If k is integer variable, the size of (k) returns 2.

40.

What is typecast?

Answer»

Typecasting is making a variable of one type, such as an int act like another type, a char, for anyone single operation.

41.

What is operator precedence?

Answer»

The order in which the arithmetic operators (+,-,*,/,%) are used in a given expression is called the order of precedence.

42.

What is implicit conversion? Give an example.

Answer»

When two operands of different types are encountered in the same expression, the lower type variable is converted to the higher type variable which is called implicit conversion. For example, float = int + float

43.

What do you mean by the precedence of operators? Give an example.

Answer»

The order in which the Arithmetic operators (+,-,*,/,%) are used in a given expression is called the order of precedence. The following table shows the order of precedence.

OrderOperators
First()
Second*,/,%
Third+,-
44.

What is the use of assignment operator? Give an example.

Answer»

The assignment operator ‘=’ is used for assigning a variable to a value. This operator takes the expression on its right-hand-side and places it into the variable on its left-hand-side.

For example: m = 5;

45.

What is a function parameter?

Answer»

Sometimes the calling function supplies some values to the called function. These are known as function parameters.

46.

Write any two rules for naming the identifier.

Answer»

Two rules for the formation of an identifier are that it can consist of alphabets, digits and/or underscores and it must not start with a digit.

47.

What are keywords? Can keywords be used as identifiers?

Answer»

Keywords are the reserved words which convey specific meaning to the C++ compiler. They are the essential elements to construct C++ programs. Most of the keywords are common to C, C++ and Java. Keywords are reserved and cannot be used as identifiers.

48.

What is the function of the keywords? Write any four keywords.

Answer»

These are some reserved words in C++ which have a predefined meaning to the compiler, called keywords. 

Some commonly used keywords are:

int, float, char, and case

49.

How many categories of data types available in C++? (a) 5 (b) 4(c) 3 (d) 2

Answer»

3 categories of data types available in C++

50.

What is the significance of void in function return type?

Answer»

A function that does not return a value is declared and defined as void.