Philips Previous Years Solved Sample Placement Papers
-
What do the following declaration signify?
int *ptr[30];
A. ptr is a pointer to an array of 30 integer pointers.
B. ptr is an array of 30 pointers to integers.
C. ptr is an array of 30 integer pointers.
D. ptr is an array 30 pointers.
Ans: B -
What is x in the following program?
#include<stdio.h> int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; }
A. x is a pointer
B. x is an array of three pointers
C. x is an array of three function pointers
-
You want to find out the value of the last element of an array. You write the following code. What will happen when you compile and run it?
public class MyAr{ public static void main(String argv[]){ int[] i = new int[5]; System.out.println(i[5]); } }
1) An error at compile time
2) An error at run time
3) The value 0 will be output
4) The string "null" will be output.
-
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
-
Write a program to remove duplicates from a sorted array.
-
In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array
Ans: C -
What will be the output of the program?
A. 2, 3, 4, 5
B. 1, 2, 3, 4
C. 0, 1, 2, 3
D. 3, 2, 1, 0
Ans: B -
At a parking lot, a sedan is parked to the right of a pickup and to the left of a sport utility vehicle.
A minivan is parked to the left of the pickup.
The minivan is parked between the pickup and the sedan.
If the first two statements are true, the third statement is:
a) true.
b) false.
c) uncertain.
Answer: a) true. -
Fact 1: All chickens are birds.
Fact 2: Some chickens are hens.
Fact 3: Female birds lay eggs.
If the first three statements are facts, which of the following statements must also be a fact?
I. All birds lay eggs.
II. Hens are birds.
III. Some chickens are not hens.
a) II only
b) II and III only
c) I, II, and III
d) None of the statements is a known fact
Answer: a) II only -
Fact 1: Most stuffed toys are stuffed with beans.
Fact 2: There are stuffed bears and stuffed tigers.
Fact 3: Some chairs are stuffed with beans.
If the first three statements are facts, which of the following statements must also be a fact?
I. Only children’s chairs are stuffed with beans.
II. All stuffed tigers are stuffed with beans.
III. Stuffed monkeys are not stuffed with beans.
a) I only
b) II only
c) II and III only
d) None of the statements is a known fact
Answer: d) None of the statements is a known fact -
Fact 1: All hats have brims.
Fact 2: There are black hats and blue hats.
Fact 3: Baseball caps are hats.
If the first three statements are facts, which of the following statements must also be a fact?
I. All caps have brims.
II. Some baseball caps are blue.
III. Baseball caps have no brims.
a) I only
b) II only
c) I, II, and III
d) None of the statements is a known fact
Answer: d) None of the statements is a known fact -
What is the area of the triangle with vertices (0, 2, 2), (2, 0, -1), and (3, 4, 0)?
A) 15/2 square units (Ans)
B) 15 square units
C) 7/2 square units
D) 7 square units
-
If 1/2 - √-2 is one of the roots of ax2 + bx + c = 0 where a, b, c are real, then what are the values of a, b, c respectively?
A) 6, -4, 1 (Ans)
B) 4, 6, -1
C) 3, -2, 1
D) 6, 4, 1