Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Wipro Elite NTH Coding Programming Q&A - Paper 1

C Programming

1. Which one of the following is correct syntax for opening a file.


a) FILE *fopen(const *filename, const char *mode)
b) FILE *fopen(const *filename)
c) FILE *open(const *filename, const char *mode)
d) FILE open(const*filename)

Answer: a
Explanation: fopen() opens the named file, and returns a stream, or NULL of the
attempt fails.

2. What will be the output of the following C code?

a) yes
b) yes no
c) Duplicate case value error
d) Character case value error

Answer: c
Wipro Elite NTH Coding Programming Q&A - Paper 1

CPP
3. What are the advantages of passing arguments by reference?
a) Changes to parameter values within the function also affect the original
arguments
b) There is need to copy parameter values (i.e. less memory used)
c) There is no need to call constructors for parameters (i.e. faster)
d) All of the mentioned

Answer: d
Explanation: All the above mentioned are advantages and properties of call by
reference.

4. Which header file is required to use any container?


a) <any>
b) <stl>
c) <container-any>
d) <containers>

Answer: a
Explanation: <any> header file is required to use any container and its realted
functions.

Java

5. What will be the output of the following Java code?


Wipro Elite NTH Coding Programming Q&A - Paper 1

a) [3, 5]
b) [3, 2]
c) [3, 2, 5]
d) [3, 5, 2]

Answer: a
Explanation: push() and pop() are standard functions of the class stack, push()
inserts in the stack and pop removes from the stack. 3 & 2 are inserted using
push() the pop() is used which removes 2 from the stack then again push is used
to insert 5 hence stack contains elements 3 & 5.
Output:

6. What is the remaining capacity of BlockingQueue whose intrinsic capacity is not


defined?
a) Integer.MAX_VALUE
b) BigDecimal.MAX_VALUE
Wipro Elite NTH Coding Programming Q&A - Paper 1

c) 99999999
d) Integer.INFINITY

Answer: a
Explanation: A BlockingQueue without any intrinsic capacity constraints always
reports a remaining capacity of Integer.MAX_VALUE.

Data Structures
7. What will be result if the given stack is popped?

a) pat
b) tap
c) atp
d) apt

Answer: b
Explanation: The word ‘pat’ is pushed on to the stack. When the characters of the
stack are popped one by one, the word ‘tap’ is obtained.

8. What is wrong with below code for inorder traversal of inorder threaded binary
tree:
Wipro Elite NTH Coding Programming Q&A - Paper 1

a) inordersuccessor instead of inorderpredecessor must be done


b) code is correct
c) it is code for post order
d) it is code for pre order

Answer: a
Explanation: Property of inorder threaded binary tree is left node with inorder
predecessor and right node with inorder successor information are stored.

9. What does the following function do for a given Linked List with first node as
head?

a) Prints all nodes of linked lists


b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order

Answer: b
Explanation: fun1() prints the given Linked List in reverse manner.
For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.

Java
10. What will be the output of the following Java program?
Wipro Elite NTH Coding Programming Q&A - Paper 1

a) 1
b) 2
c) 3
d) 4

Answer: b
Explanation: trimTosize() is used to reduce the size of the array that
underlines an ArrayList object.
https://www.freshersnow.com/placement-papers-download/
Output:

You might also like