Aptitude [Subex Placement]: Sample Questions 1 - 2 of 19

Doorsteptutor material for competitive exams is prepared by world's top subject experts: get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 1

Aptitude
Edit

Write in Short

Short Answer▾

What does (⚹ a) [10] means?

Explanation

  • A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type. The unary or monadic operator (&) gives the “address of a variable” . The indirection or dereference operator (⚹) gives the “contents of an object pointed to by a pointer” .
  • An array is a collection of similar elements (i.e.. same data type) . We can use a pointer to an array and then we can use that pointer to access the array. We can declare array like, z [5] i.e.. z is an array of 5 elements, z [0] , z [1] , z [2] , z [3] , z [4]
  • Here, a is a pointer to an array of 10 integers.

Question 2

Aptitude
Edit

Write in Short

Short Answer▾

What will be the output of the following code?

  1. main()
  2. {
  3.     intx=128;
  4.     printf("n%d",1+x++);
  5. }

Explanation

  • Here, one integer variable x is initialized in the main () function with 128. In the printf function we can write those things which we want to get printed on screen. Here, is the escape sequence for new line. % d is the format specifier for integer variables. x ++ is the post increment operator on x. In post increment operator first value of variable is assigned to the assignment operator and then value of variable gets incremented by 1.
  • So, (1) + (x ++) = 1 + x = 1 + 128 = 129
  • And 129 will be printed as output on the next line of screen.
  • Now value of variable x is incremented by 1 and becomes 129.

Developed by: