RRB Â computer Programming Questions, C,C++,CH|RRB Aptitude Reasoning, General Awareness
RRB Electronics ,Mechanical, Computer and Diesel Engg questions with answersÂ
RRB Computer Science Questions
1.Pascal, BASIC and C are programming languages, while C++ is an _________ language.
a)Assembly languageÂ
b)ProceduralÂ
c)Object-oriented programming-Answer
d)Programming
2.Which of the following are good reasons to use an object-oriented language?
a)You can define your own data types -Answer
b)Program statements are simple than in procedural languageÂ
c)An OO Program can be taught to correct its own errors
d)Itâs easier to conceptualize an OO program-Answer
3.When a language has the capability to produce new data types, it is said to beÂ
a)reprehensible
b)encapsulated
c)overloaded
d)extensible-Answer
4.A normal C++ operator that acts in special ways on newly defined data types is said to beÂ
a)glorified
b)encapsulatedÂ
c)classifiedÂ
d)overloaded-Answer
5.Memorizing the new terms used in C++ isÂ
a)critically important
b)something you can return to later-Answer
c)the key to wealth and success
d)completely irrelevant
6.Protecting data from access by unauthorized functions is called _____
a)extensibilityÂ
b)encapsulation-Answer
c)overloadingÂ
d)inheritance
7.Dividing a program into functionsÂ
a)is the key to OOP
b)makes the program easier to conceptualize-Answer
c)may reduce the size of the program-Answer
d)makes the program run faster
8.True or falseIn an assignment statement, the value on the left of the equal sign is always equal to the value on the right-False
9.True or false:Itâs perfectly all right to use variables of different data types in the same arithmetic expression.-True
10.A relational operator
a)assigns one operand to another
b)yields a Boolean result
c)compares two operands-Answer
d)logically combines two operands
11.A variable defined within a block is visible
a)from the point of definition onward in the program
b)from the point of definition onward in the function
c)from the point of definition onward in the block-Answer
d)throughout the function
12.True or false:Relational operators have a higher precedence than arithmetic operators.-False
13.The library function exit () causes an exit from
a)the loop in which it occurs
b)the block in which it occurs
c)the function in which it occurs
d)the program in which it occurs-Answer
14.The getche () library functionÂ
a)returns a character when the key is pressed-Answer
b)returns a character when Enter is pressed
c)displays a character on the screen when any key is pressed-Answer
d)does not display a character on the screen
15.The & & and operators
a)compare two numeric values
b)combine two numeric values
c)compare two Boolean values-Answer
d)combine two Boolean values
16.The break statement causes an exit
a)only from the innermost loop
b) only from the innermost switch
c) from all loops and switches-Answer
d)from the innermost loop or switch
17.The goto statement causes control to go to
a)an operator
b)a label-Answer
c)a variable
d)a function
18.A structure brings together a group ofÂ
a)items of the same data type
b)related data items-Answer
c)integers with user-defined names
d)variables-Answer
19.True or false:A structure specifier creates space in memory for a variable-True
20.An enumerated data type brings together a group ofÂ
a)items of different data types
b)related data variables
c)integers with user-defined names
d)constant values-Answer
21.A functionâs single most important role is to
a)give a name to a block of codeÂ
b)related data variables
c)accept arguments and provide a return value
d)help organize a program into conceptual units-Answer
22.Which of the following canât legitimately be passed to a function?
a)a constant
b)a variable
c)a structure
d)a header file-Answer
23.When an argument is passed by reference
a)a variable is created in the function to hold the argumentâs value-Answer
bThe function cannot access the argumentâs value
c)a temporary variable is created in the calling program to hold the argumentâs value
d)the function accesses the argumentâs original value in the calling program
24.Overloaded functions
a)are a group of functions with the same name
b)all have the same number and types of arguments
c)make life simpler for programmers-Answer
d)may fail unexpectedly due to stress
25.A default argument has a value that
a)may be supplied by the calling program-Answer
b)may be supplied by the function -Answer
c)must have a constant value
d)must have a variable value
26.A static automatic variable is used toÂ
a)make a variable visible to several functions
bmake a variable visible to only one function-Answer
c)conserve memory when a function is not executingÂ
d)retain a value when a function is not executing -Answer
27.In a class specifier, data or functions designated private are accessible
a)to any function in the programÂ
b)only if you know the password
c)to member functions of that class -Answer
d)only to public members of the class
28.True or false:In a class you can have more than one constructor with the same name -True
29.An array element is accessed using
a)a first-in first-out approachÂ
b)the dot operator
c)a member name
d)an index number-Answer
30.When an array name is passed to a function, the function
a)accesses exactly the same array as the calling program-AnswerÂ
b)accesses a copy of the array passed by the program
c)refers to the array using the same name as that used by the calling program
d)refers to the array using a different name from that used by the calling program-Answer
31.To convert from a user-defined class to a basic type, you would most likely use
a)a built-in conversion functionÂ
b)a one-argument constructor
c)an overloaded = operator
d) a conversion function thatâs a member of the class-Answer
32.Inheritance is a way to
a)make general classes into more specific classes-Answer
b)pass arguments to objects of classes
c)add features to existing classes without rewriting them-Answer
d)improve data-hiding and encapsulation
33.A âchildâ class is said to be from a base class
a)parent class
b)derived class-Answer
c)existing classÂ
34.The scope-resolution operator (:) usually
a)limits the visibility of variables to a certain functionÂ
b)tells what base class, a class is derived from
c)specifies a particular class-Answer
d)resolves ambiguities-Answer
35.A class hierarchy
a)shows the same relationships as an organization chartÂ
b)describes âhas aâ relationshipsÂ
c)describes âis a kind of â relationships -Answer
d)shows the same relationships as a family tree
36.A pointer isÂ
a)the address of a variableÂ
b)an indication of the variable to be accessed next
c)a variable for storing addresses -Answer
d)the data type of an address variable
37The new operator
a)returns a pointer to a variableÂ
b)creates a variable called new
c)obtains memory for a new variable-Answer
d)tells how much memory is available
38.In a linked list
a)each link contains a pointer to the next link-AnswerÂ
b)an array of pointers point to the links
c)each link contains data or a pointer to data-Answer
d)the links are stored in an arrayÂ
39.If you wanted to sort many large objects or structures, it would be most efficient toÂ
place them in an array and sort the arrayÂ
b)place pointers to them in an array and sort the array-Answer
c)place them in a linked list and sort the linked list
d)place references to them in an array and sort the array
40.A C++ stream isÂ
a)the flow of control through a functionÂ
b)a flow of data from one place to another-Answer
41.To write data that contains variable of type float, to an object of type of stream, you should useÂ
a)the insertion operatorÂ
b)seekg ()
c)write ()-Answer
d)put ()
42. Mode bits such as APP and ATE canât do any of the following:
a)are defined in the IOS classÂ
b)can specify if a file is open for reading or writing
c)work with the put() and get() functions-Answer
d)specify ways of opening a file
43.Redirection redirects
a)a stream from a file to the screen -AnswerÂ
ba file from a device to a stream
c)a device from the screen to a file
d)the screen from a device to a stream
44.The process of allocating memory at run time is know asÂ
a)Static memory allocationÂ
b)dynamic memory allocation-Answer
c)memory reallocation
45.In C language, a block of memory may be allocated using the functionÂ
acallocÂ
b)malloc-Answer
c)free
d)realloc
46.___________ allocates multiple blocks of storage, each of the same size. and then sets all bytes to zero.Â
a)mallocÂ
b)calloc-Answer
c)free
d)realloc
47.Structures which contain a member field that point to the member field that point to the same structure types are calledÂ
astructure within a structureÂ
b)self-referencial structure-Answer
cunions
48.C does not have an operator forÂ
a)modulo divisionÂ
b)unary
c)exponentiation-Answer
d)Bitwise
49.C compilers support fundamental data typesÂ
a)5Â
b)3
c)4-Answer
d)2
50.Every C program must have one _________ function sectionÂ
a)printf ()Â
b)main ()-Answer
c)getch ()