Answer of Coding Exam 01
Answer of Coding Exam 01
CODING TEST-01
[[[
This Section has 40 questions and each question carry equal marks.
Q1. The number of tokens in C Language, printf(“i = %d, &i – %x”, i, &i); 1 point
a. 3
b. 10
c. 25
d. 12
Clear selection
Q2. Let x be an integer which can take a value of 0 or 1. The statement in C, 1 point
a. x = 1 + x;
b. x = 1 - x;
c. x = x - 1;
d. x = 1 % x;
Clear selection
Q3. Suppose that in a C program snippet, followings statements are used. 1 point
b. i), ii) and iii) would compile successfully and size of each would be same i.e. 4
c. i), ii) and iii) would compile successfully but the size of each would be different
and would be decided at run time.
d. ii) and iii) would result in compile error but i) would compile and result in size as 4.
Clear selection
Q4. Which of the following statements are used in Exception Handling in 1 point
Python?
a. try
b. except
c. finally
Clear selection
Q5. Assume int is 4 bytes, char is 1 byte and float is 4 bytes. Also, assume 1 point
a. 4 4 4
b. 1 4 4
c. 1 4 8
Clear selection
Q6. Which of the following is the proper syntax to check if a particular 1 point
element is present in a list?
a. if ele in list
c. Both of a and b
Clear selection
Q7. Which of the following functions converts date to corresponding time in 1 point
Python?
a. strptime()
b. strftime()
c. Both A and B
Clear selection
Q8. Which of the following statement is correct for switch controlling 1 point
expression?
c. All types i.e. int, char and float can be used in “switch” control expression
Clear selection
Q9. Which of the followings is/are automatically added to every class, if we 1 point
do not write our own.
a. Copy Constructor
b. Assignment Operator
Clear selection
Q10. Find the output of given program- 1 point
a. Compiler Error
c. 10 10
d. 10 0
Clear selection
Q11. What is the difference between struct and class in C++? 1 point
a. Members of a class are private by default and members of struct are public by
default. When deriving a struct from a class/struct, default access-specifier for a
base class/struct is public and when deriving a class, default access specifier is
private.
b. All members of a structure are public and structures don't have constructors and
destructors
c. All members of a structure are public and structures don't have virtual functions
Clear selection
Q12. A member function can always access the data in __________ , (in C++). 1 point
Clear selection
a. 1
b. 2, 4
c. 4
d. 2, 3, 4
Clear selection
a. Yes
b. No
Clear selection
Q15. Which of the following are valid string manipulation functions in 1 point
Python?
a. count()
b. upper()
c. strip()
Clear selection
Q16. Predict the output of following C++ program. 1 point
a. x = 5
b. x = 10
c. Compiler Error
d. Runtime Error
Clear selection
a. Inheritance
b. Polymorphism
c. Encapsulation
Clear selection
Q18. If a function is friend of a class, which one of the following is wrong? 1 point
b. Friend functions are not members of a class, they are associated with it.
d. It can have access to all members of the class, even private ones
Clear selection
Q19. How to create a dynamic array of pointers (to integers) of size 10 using 1 point
new in C++? Hint: We can create a non-dynamic array using int *arr[10]
d. Not Possible
Clear selection
a. Only 1
b. 1, 2 and 3
c. 1 and 2
d. 1 and 3
Clear selection
Q21. Which of the following is FALSE about abstract classes in Java 1 point
a. If we derive an abstract class and do not implement all the abstract methods, then
the derived class should also be marked as abstract using 'abstract' keyword
Clear selection
d. which translates JDBC function calls into API not native to DBMS
Clear selection
Clear selection
Q24. Predict the output of the following program. 1 point
a. a = 10
b. a = 20
c. Compilation error
d. None of these
Clear selection
Q25. Predict the output in Java? 1 point
a. 10 20 30 40 50
b. 10 20 30 40
c. Compiler Error
d. None of given
Clear selection
b. Classes, even though they are visible outside their package, can have fields visible
to packages only
c. We can have hidden classes that are used by the packages, but not visible outside.
Clear selection
Q27. Output of following Java Program? 1 point
a. Base::show() called
b. Derived::show() called
c. Compiler Error
d. Runtime Error
Clear selection
Clear selection
a. instanceof
b. new
c. sizeof
d. >>>=
Clear selection
Q30. Find the output in java- 1 point
a. i = 10, j = 20
b. i = 20, j = 10
c. i = 10, j = 10
d. i = 20, j = 20
Clear selection
a. Error
b. None
c. abcd
d. [‘a’,’b’,’c’,’d’]
Clear selection
Q32. What is the output of the following program : 1 point
a. 48
b. 14
c. 64
Clear selection
a. Module
b. Class
c. Another Function
d. Method
Clear selection
Q34. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)? 1 point
Clear selection
Q35. Consider the results of a medical experiment that aims to predict 1 point
whether someone is going to develop myopia based on some physical
measurements and heredity. In this case, the input dataset consists of the
person’s medical characteristics and the target variable is binary: 1 for those
who are likely to develop myopia and 0 for those who aren’t. This can be best
classified as
a. Regression
b. Decision Tree
c. Clustering
d. Association Rules
Clear selection
Q36. What is the output of the following program : print 0.1 + 0.2 == 0.3 1 point
a. True
b. False
c. Machine dependent
d. Error
Clear selection
a. Lists
b. Dictionary
c. Tuples
d. Class
Clear selection
Q38. Which of the following statement(s) is TRUE? 1 point
a. only 1
b. 2 and 3
c. 1 and 3
d. only 2
Clear selection
a. 1
b. 3
c. 9
d. 27
Clear selection
a. 0 1 2 0
b. 0 1 2
c. Error
Clear selection