RRB Computer Science Questions

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 ()

Leave a Reply0

Your email address will not be published.