JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Aptitude - Programming Language
By Team Innovation Instigators
* Indicates required question
Email
*
Record my email address with my response
11. Which of the following functions is used to get the length of a string in PHP?
*
a. strlen()
b. length()
c. size()
d. count()
23. class Main {
public static void main(String args[]) {
System.out.println(fun());
}
int fun()
{
return 20;
}
}
what is the output of the above code
*
a. 20
b. compiler error
c. 0
d. garbage value
31. What is the purpose of the def keyword?
*
a. Defines a variable
b. Imports a module
c. Checks the equality of two values
d. Declares a function
40. What is the key characteristic of a tuple?
*
a. Mutable
b. Ordered
c. Dynamic
d. Indexed
32. Which keyword is used to skip the rest of the code in the current iteration of a loop and move to the next iteration?
*
a. continue
b. pass
c. skip
d. next
39. Which of the following function is more appropriate for reading in a multi-word string?
*
a. printf();
b. scanf();
c. puts();
d. gets();
19. Which of the following is true for a circular queue?
*
a. Front and rear are always at the beginning.
b. It can be implemented using a linked list.
c. It can handle overflow in a better way than a linear queue.
d. Both B and C
37. Which two are valid constructors for Thread?
1.Thread(Runnable r, String name)
2.Thread()
3.Thread(int priority)
4.Thread(Runnable r, ThreadGroup g)
5.Thread(Runnable r, int priority)
*
a. 1 and 3
b. 2 and 4
c. 1 and 2
d. 2 and 5
9. Which of the following is the correct way to define a function in PHP?
*
a. function myFunction() {}
b. def myFunction() {}
c. func myFunction() {}
d. function: myFunction() {}
Enter your name?
*
Your answer
15. What is the result of the following Python expression?
python
print(10 // 3)
*
a. 3.33
b. 3
c. 10
d. 3.0
28. How many times the program will print "Innovation Instigators" ?
#include<stdio.h>
int main()
{
printf("Innovation Instigators");
main();
return 0;
}
*
a. Infinite times
b. 32767 times
c. 65535 times
d. Till stack overflows
33. Which loop in Python is used for iterating over a sequence until a specified condition is False?
*
a. for loop
b. if loop
c. do-while loop
d. while loop
27. Which of the following is the correct usage of conditional operators used in C?
*
a. a>b ? c=30 : c=40;
b. a>b ? c=30;
c. max = a>b ? a>c?a:c:b>c?b:c
d. return (a>b)?(a:b)
29. What is stderr ?
*
a. standard error
b. standard error types
c. standard error streams
d. standard error definitions
8. What will be the output of the following code?
#include<stdio.h>
int main(){
printf("%d", 5/2);
return 0;
}
*
a. 2.5
b. 2
c. 2.0
d. Compilation error
Enter e-mail
*
Your answer
3. Number of primitive data types in Java are ?
*
a. 6
b. 7
c. 8
d. 9
2. What is the use of final keyword in Java?
*
a. When a class is made final, a subclass of it can not be created.
b. When a method is final, it can not be overridden.
c. When a variable is final, it can be assigned value only once.
d. All of the above
26.Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
*
a. * / % + - =
b. = * / % + -
c. / * % - + =
d. * % / - + =
17. In C++, which of the following operators is used to allocate memory dynamically?
*
a. new
b. malloc()
c. calloc()
d. alloc()
\ 1. Linear search is also called
*
a. Random Search
b. Sequential search
c. Perfect search
d. None
22. class Test {
int i;
}
class Main {
public static void main(String args[]) {
Test t;
System.out.println(t.i);
}
*
a. 0
b. garbage value
c. compiler error
d. runtime error
13. Which of the following is NOT a type of linked list?
*
a. Singly Linked List
b. Doubly Linked List
c. Circular Linked List
d. Array Linked List
5. When is the object created with new keyword?
*
a. At run time
b. At compile time
c. Depends on the code
d. none
14. What does the following Python code do?
python
x = "Python"
print(x[0:3])
*
a. Prints "Py"
b. Prints "Pyt"
c. Prints "thon"
d. Error
12. In a binary tree, what is the maximum number of nodes at level l?
*
a. l
b. 2^l
c. 2l
d. l^2
10. What is the result of the following code?
int a = 10;
a++;
printf("%d", a);
*
a. 9
b. 10
c. 11
d. Compilation error
18. Which of the following algorithms is used to find the shortest path in a graph?
*
a. Depth First Search (DFS)
b. Breadth First Search (BFS)
c. Dijkstra's Algorithm
d. Kruskal's Algorithm
30. Which header file should be included to use functions like malloc() and calloc()?
*
a. memory.h
b. stdlib.h
c. string.h
d. dos.h
16. In C, which header file is required to use malloc()?
*
a. stdlib.h
b. stdio.h
c. math.h
d. string.h
25. In which numbering system can the binary number 1011011111000101 be easily converted to?
*
a. Decimal system
b. Hexadecimal system
c. Octal system
d. No need to convert
6. Who invented C++?
*
a. Dennis Ritchie
b. Ken Thompson
c. Brian Kernighan
d. Bjarne Stroustrup
36. What is the name of the method used to start a thread execution?
*
a. init();
b. start();
c. run();
d. resume();
21. #include <stdio.h>
int main() {
int i;
if (printf("0"))
i = 3;
else
i = 5;
printf("%d", i);
return 0;
}
What is the output of above program?
*
a. 3
b. 5
c. 03
d. 05
24. #include <stdio.h>
int main()
{
int i;
i = 1, 2, 3;
printf("%d", i);
return 0;
}
*
a. 1
b. 3
c. Garbage value
d. Compile error
38. Which of the following function is used to find the first occurrence of a given string in another string?
*
a. strstr()
b. strchr()
c. strrchr()
d. strnset()
7. Which of the following is the correct syntax of including a user defined header files in C++?
*
a #include [userdefined]
b. #include “userdefined”
c. #include <userdefined.h>
d. #include <userdefined>
35. Which of the following is a correct way to iterate over a list in reverse order?
*
a. for item in reversed(my_list):
b. for item in my_list.reverse():
c. for item in reverse(my_list):
d. for item in my_list[::-1]:
34. What does the range function return when used with two arguments, start and stop?
*
a. A sequence from start to stop (exclusive)
b. A sequence from start to stop (inclusive)
c. A sequence of even numbers from start to stop
d. A reversed sequence from start to stop (inclusive)
4. When an array is passed to a method, what does the method receive?
*
a. The reference of the array
b. A copy of the array
c. Length of the array
d. Copy of first element
20.#include <stdio.h>
#define PRINT(i, limit) do
{
if (i++ < limit)
{
printf("Innovation instigators\\n");
continue;
}
}while(0);
int main()
{
int i = 0;
PRINT(i, 3);
return 0;
}
How many times Innovation instigators is printed in the above program ?
*
a. 1
b. 3
c. 4
d. Compiler error
Submit
Clear form
Never submit passwords through Google Forms.
Forms
This content is neither created nor endorsed by Google.
Report Abuse
Terms of Service
Privacy Policy
Help and feedback
Contact form owner
Help Forms improve
Report