SlideShare a Scribd company logo
Technical
Aptitude Test
Date : 18-03-2016
Q.1. Choose one that apply:
class S{
public static void main(String agr[]){
short s1=4; //LINE 1
short s2 = s1+=s1; //LINE 2
short s3= s1+s2; //LINE 3
byte b1=(byte)s1 +(byte)s2; //LINE 4
byte b2=(byte)((byte)s1 +(byte)(byte)s2); //LINE 5 }}
A. Comiler Error at Line 1,2,3 B. Compiler Error at Line 3,4.
C. Compiler Error at 2,3,5 D. Comiler Error at 1,4,5
Q.2 Classes that can be used to instantiate objects are called concrete
classes.
A.TRUE B.FALSE
Q. 3. char ** array [12][12][12]; Consider array, defined above. Which
one of the following definitions and initializations of p is valid?
A) char ** (* p) [12][12] = array;
B) char ***** p = array;
C) char * (* p) [12][12][12] = array;
D) const char ** p [12][12][12] = array;
E) char (** p) [12][12] = array;
Q.4 What is the result of following java code?
public class Apti {
static void test(int[] a) {
int[] b = new int[2];
a = b;
System.out.print(b.length);
System.out.print(a.length); }
public static void main(String[] args) {
int[] a = new int[5];
test(a);
System.out.print(a.length);
}
}
A.225 B.255 C.200 D.222
Q.5 what is the o/p?
main(){
printf(“%%%%%”);
}
A.%%%%%
B.%%%%
C.%%%
D.%%
Q.6 . #include<iostream>
using namespace std;
int x = 1;
void fun(){
int x = 2;
{
int x = 3; cout << ::x << endl;
}
}
int main()
{
fun();
return 0;
}
A.1 B.2 C.3 D.0
Q.7 What will be the result of compiling and running the following
program ?
public class ExceptionTest{
public static void main(String[] args) throws Exception{
try{
m2();
}finally{ m3(); }
catch ( NewException e ){}
}
public static void m2() throws NewException { throw new
NewException(); }
public static void m3() throws AnotherException{ throw new
AnotherException(); }
A. It will compile but will throw AnotherException when run.
B. It will compile but will throw NewException when run.
C. It will compile and run without throwing any exceptions.
D. It will not compile.
Q. 8 main(){
extern int i;
i=20;
printf("%d",i); }
Output is:
(A)0
(B)20
(C)would vary from compiler to compiler
(D)Error : Undefined symbol i
Q.9 Which type of casting can be used only with pointers and
references to objects?
A) Dynamic_cast B) cast C)Static_cast D) Pointer_Cast
Q.10 class Student extends String{} What happens when we try to compile
this class?
A) Will not compile because class body is not defined
B) Will not compile because the class in not declared public.
C) Will not compile because String is abstract.
D) Will not compile because String is final.
Q. 11 What will be output when you will execute following c code?
#include<stdio.h>
void main(){
int a=5,b=10;
if(a<++a||b<++b)
printf("C rocks, everyone shocks");
else
printf("%d %d",a,b);
}
(A)6 11 (B)6 10 (C)C rocks, everyone shocks (D)none of above
Q.12 What will the following code print?
int[] scores1 = { 1, 2, 3, 4, 5, 6};
int[] scores2 = { 0, 0, 0, 0, 0, 0};
System.arraycopy(scores2, 2, scores1, 3, 2);
for(int i : scores2) System.out.print(i);
A. 123006
B. 000000
C. 000450
D. It throw an exception at run time.
Q.13. int main() {
int number1 = 88, number2 = 22;
int & refNumber1 = number1;
refNumber1 = 11;
cout << refNumber1 << endl;
refNumber1 = number2;
number2++;
cout << refNumber1 << endl;
cout << number1 << endl;
cout << number2 << endl;
} O/p:-
A.88 23 23 23 B.11 22 22 23 C.11 22 23 23
D.11 23 23 23 E.88 22 22 23
Q.14 What will be output when you will execute following c code?
#include<stdio.h>
void main(){
int a=5; a=a>=4;
switch(2){
case 0:int a=8;
case 1:int a=10;
case 2:++a;
case 3:printf("%d",a);
}
}
(A) 2 (B) 10 (C) Compilation error (D)no output
Q.15 Which of the following should be used 'if content is not fixed and
keep on changing(mutable) but Thread safety is required'?
A. String B. StringBuffer C. StringBuilder D. Both B & C
Q.16 #include<stdio.h>
void main(){
int a=3,b=2;
a=a = = b = = 0;
switch(a){
case 1:a=a+10;
}
sizeof(a++);
printf("%d",a);
}
(A)11 (B)12 (C)1 (D)0
Associativity : left to right
Q.17 Which of the following concepts means waiting until runtime to
determine which function to call?
A. Data hiding B. Dynamic casting C. Dynamic binding D.
Dynamic loading
Q.18 Which of the following are true about the "default" constructor?
Choose 2 options:
A. It is provided by the compiler only if the class does not define any
constructor.
B. It initializes the instance members of the class.
C. It calls the default 'no-args' constructor of the super class.
D. It initializes instance as well as class fields of the class.
E. It is provided by the compiler if the class does not define a 'no- args'
constructor.
Q.19 What will be output when you will execute following c code?
#define PRINT printf("Star Wars");printf(" Psycho");
#include<stdio.h>
void main(){
int x=1;
if(x--)
PRINT
else
printf("The Shawshank Redemption");
} Choose all that apply:
(A) Stars Wars Psycho
(B) The Shawshank Redemption
(C) Warning: Condition is always true
(D) Compilation error
Q.20 Why reference is not same as a pointer?
A. A reference can never be null.
B. A reference once established cannot be changed.
C. Reference doesn't need an explicit dereferencing mechanism.
D. All of the above.
Q.21 Which of the following sorting algorithms can be used to sort a
random linked list with minimum time complexity?
A.Insertion Sort B.Quick Sort C.Heap Sort D.Merge Sort
Explanation: Both Merge sort and Insertion sort can be used for linked lists.
The slow random-access performance of a linked list makes other
algorithms (such as quicksort) perform poorly, and others (such as
heapsort) completely impossible. Since worst case time complexity of
Merge Sort is O(nLogn) and Insertion sort is O(n^2), merge sort is
preferred.
Q.22. A circularly linked list is used to represent a Queue. A single
variable p is used to access the Queue. To which node should p point
such that both the operations enQueue and deQueue can be performed
in constant time?
A. rear node
B. Front node
C. not possible with single pointer
D. node next to front
Q.23 A function f defined on stacks of integers satisfies the following
properties. f(∅) = 0 and f (push (S, i)) = max (f(S), 0) + i for all stacks S
and integers i.
If a stack S contains the integers 2, -3, 2, -1, 2 in order from bottom to
top, what is f(S)?
A.6 B.4 C.3 D.2
Q.24. In a complete k-ary tree, every internal node has exactly k
children or no child. The number of leaves in such a tree with n internal
nodes is:
A.nk B.(n-1)k+1 C. n(k-1)+1 D.n(k-1)
Q.25. How many distinct binary search trees can be created out of 4
distinct keys?
A.4 B.14 C.24 D.42
The base case is t(0) = 1 and
t(1) = 1
Q.26. What is time complexity of fun()?
int fun(int n)
{
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
A O(n^2) B.O(nLogn) C.O(n) D. O(nLognLogn)
Q.27. class Test
{
int p = 20;
public static void main(String args[]){
final Test t = new Test();
t.p = 30;
System.out.println(t.p);
}
}
A.20 B.30 C. Compile time error D. Runtime error
Q.28. What will be the result of attempting to compile and run the
following program?
public class TestClass{
public static void main(String args[ ] ){
String s = "hello";
StringBuilder sb = new StringBuilder( "hello" );
sb.reverse();
s.reverse();
if( s == sb.toString() ) System.out.println( "Equal" );
else System.out.println( "Not Equal" );
}
}
A. Compilation error. B. It will print 'Equal'.
C. It will print 'Not Equal'. D. Runtime error.
No reverese method in String.
Q.29. Which of the following statements are true?
A. For any non-null reference o1, the expression (o1 instanceof o1) will
always yield true.
B. For any non-null reference o1, the expression (o1 instanceof
Object) will always yield true.
C. For any non-null reference o1, the expression (o1 instanceof o1) will
always yield false.
D. For any non-null reference o1, the expression (o1 instanceof Object)
may yield false.
Q.30 import java.util.*;
public class Test {
public static void main(String[] args) {
TreeSet s = new TreeSet();
s.add(1);
s.add(99.9);
s.add(99.9);
s.add(96.9);
for (int i = 0; i < s.size(); i++) {
System.out.print(s.pollFirst()+" ");
} }}
A. 1 96.9 99.9 B.1 96.9 99.9 99.9 C.1 D.compilation error
E.an exception is thrown at run time

More Related Content

PPTX
Technical aptitude Test 1 CSE
DOC
Software testing objective_types
ODP
Charla sobre Desarrollo de Aplicaciones en Asterisk con AGI para el ENLI 2012
PPTX
C++ ppt
PPT
Different loops in C
PDF
66781291 java-lab-manual
PDF
Istqb question-paper-dump-1
PPTX
Parsing in Compiler Design
Technical aptitude Test 1 CSE
Software testing objective_types
Charla sobre Desarrollo de Aplicaciones en Asterisk con AGI para el ENLI 2012
C++ ppt
Different loops in C
66781291 java-lab-manual
Istqb question-paper-dump-1
Parsing in Compiler Design

What's hot (20)

PPTX
Pumping lemma Theory Of Automata
PPTX
2.7 normal forms cnf & problems
PPTX
Software Evolution
PDF
Ppsc data entry operator 2017 solved past papers atif pedia
PDF
Solved question paper of Assistant computer operator of PSC conducted on 2018
PPTX
Chomsky Normal Form
PDF
C and data structure
PPTX
Peephole optimization techniques
DOCX
Code generation errors and recovery
PDF
MG6088 SOFTWARE PROJECT MANAGEMENT
PDF
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
PDF
OOM MCQ 2018
PPTX
Pumping lemma
PPTX
Requirements analysis and modeling
PPTX
Java exception handling
PPT
Introduction to gdb
PDF
Exception handling
PPTX
Q-learning
PPT
Basics of c++
Pumping lemma Theory Of Automata
2.7 normal forms cnf & problems
Software Evolution
Ppsc data entry operator 2017 solved past papers atif pedia
Solved question paper of Assistant computer operator of PSC conducted on 2018
Chomsky Normal Form
C and data structure
Peephole optimization techniques
Code generation errors and recovery
MG6088 SOFTWARE PROJECT MANAGEMENT
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
OOM MCQ 2018
Pumping lemma
Requirements analysis and modeling
Java exception handling
Introduction to gdb
Exception handling
Q-learning
Basics of c++
Ad

Similar to Technical aptitude test 2 CSE (20)

PDF
Tcs sample technical placement paper level i
DOCX
Technical questions
DOCX
Data structures and algorithms unit i
PDF
Java MCQ Important Questions and Answers
PDF
Core java
PDF
1z0 851 exam-java standard edition 6 programmer certified professional
DOCX
FSOFT - Test Java Exam
PDF
Computer programming mcqs
PDF
Gsp 125 final exam guide
PDF
GSP 125 Final Exam Guide
PDF
GSP 125 Final Exam Guide
DOCX
C question bank
PDF
Fnt software solutions placement paper
PDF
Ee693 questionshomework
DOCX
Exam for c
PDF
Starting Out with Java Early Objects 6th Edition Gaddis Test Bank
PDF
Devry CIS 355A Full Course Latest
DOCX
Question 1 The syntax for accessing a class (struct) member .docx
PDF
Answers withexplanations
PDF
Data Structure and Algorithm
Tcs sample technical placement paper level i
Technical questions
Data structures and algorithms unit i
Java MCQ Important Questions and Answers
Core java
1z0 851 exam-java standard edition 6 programmer certified professional
FSOFT - Test Java Exam
Computer programming mcqs
Gsp 125 final exam guide
GSP 125 Final Exam Guide
GSP 125 Final Exam Guide
C question bank
Fnt software solutions placement paper
Ee693 questionshomework
Exam for c
Starting Out with Java Early Objects 6th Edition Gaddis Test Bank
Devry CIS 355A Full Course Latest
Question 1 The syntax for accessing a class (struct) member .docx
Answers withexplanations
Data Structure and Algorithm
Ad

More from Sujata Regoti (8)

PDF
Social media connecting or disconnecting
PPTX
Image retrieval
PPTX
Key management
PPTX
Web mining tools
PPTX
Servlet and jsp interview questions
PPTX
Git,Github,How to host using Github
PPTX
Big Data
PPTX
Inflation measuring
Social media connecting or disconnecting
Image retrieval
Key management
Web mining tools
Servlet and jsp interview questions
Git,Github,How to host using Github
Big Data
Inflation measuring

Recently uploaded (20)

PPT
Total quality management ppt for engineering students
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
737-MAX_SRG.pdf student reference guides
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PPTX
introduction to high performance computing
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
communication and presentation skills 01
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PPTX
Artificial Intelligence
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
UNIT - 3 Total quality Management .pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Total quality management ppt for engineering students
III.4.1.2_The_Space_Environment.p pdffdf
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
Abrasive, erosive and cavitation wear.pdf
737-MAX_SRG.pdf student reference guides
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
introduction to high performance computing
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
communication and presentation skills 01
86236642-Electric-Loco-Shed.pdf jfkduklg
Artificial Intelligence
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Fundamentals of Mechanical Engineering.pptx
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
UNIT - 3 Total quality Management .pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...

Technical aptitude test 2 CSE

  • 2. Q.1. Choose one that apply: class S{ public static void main(String agr[]){ short s1=4; //LINE 1 short s2 = s1+=s1; //LINE 2 short s3= s1+s2; //LINE 3 byte b1=(byte)s1 +(byte)s2; //LINE 4 byte b2=(byte)((byte)s1 +(byte)(byte)s2); //LINE 5 }} A. Comiler Error at Line 1,2,3 B. Compiler Error at Line 3,4. C. Compiler Error at 2,3,5 D. Comiler Error at 1,4,5
  • 3. Q.2 Classes that can be used to instantiate objects are called concrete classes. A.TRUE B.FALSE Q. 3. char ** array [12][12][12]; Consider array, defined above. Which one of the following definitions and initializations of p is valid? A) char ** (* p) [12][12] = array; B) char ***** p = array; C) char * (* p) [12][12][12] = array; D) const char ** p [12][12][12] = array; E) char (** p) [12][12] = array;
  • 4. Q.4 What is the result of following java code? public class Apti { static void test(int[] a) { int[] b = new int[2]; a = b; System.out.print(b.length); System.out.print(a.length); } public static void main(String[] args) { int[] a = new int[5]; test(a); System.out.print(a.length); } } A.225 B.255 C.200 D.222
  • 5. Q.5 what is the o/p? main(){ printf(“%%%%%”); } A.%%%%% B.%%%% C.%%% D.%%
  • 6. Q.6 . #include<iostream> using namespace std; int x = 1; void fun(){ int x = 2; { int x = 3; cout << ::x << endl; } } int main() { fun(); return 0; } A.1 B.2 C.3 D.0
  • 7. Q.7 What will be the result of compiling and running the following program ? public class ExceptionTest{ public static void main(String[] args) throws Exception{ try{ m2(); }finally{ m3(); } catch ( NewException e ){} } public static void m2() throws NewException { throw new NewException(); } public static void m3() throws AnotherException{ throw new AnotherException(); } A. It will compile but will throw AnotherException when run. B. It will compile but will throw NewException when run. C. It will compile and run without throwing any exceptions. D. It will not compile.
  • 8. Q. 8 main(){ extern int i; i=20; printf("%d",i); } Output is: (A)0 (B)20 (C)would vary from compiler to compiler (D)Error : Undefined symbol i Q.9 Which type of casting can be used only with pointers and references to objects? A) Dynamic_cast B) cast C)Static_cast D) Pointer_Cast
  • 9. Q.10 class Student extends String{} What happens when we try to compile this class? A) Will not compile because class body is not defined B) Will not compile because the class in not declared public. C) Will not compile because String is abstract. D) Will not compile because String is final. Q. 11 What will be output when you will execute following c code? #include<stdio.h> void main(){ int a=5,b=10; if(a<++a||b<++b) printf("C rocks, everyone shocks"); else printf("%d %d",a,b); } (A)6 11 (B)6 10 (C)C rocks, everyone shocks (D)none of above
  • 10. Q.12 What will the following code print? int[] scores1 = { 1, 2, 3, 4, 5, 6}; int[] scores2 = { 0, 0, 0, 0, 0, 0}; System.arraycopy(scores2, 2, scores1, 3, 2); for(int i : scores2) System.out.print(i); A. 123006 B. 000000 C. 000450 D. It throw an exception at run time.
  • 11. Q.13. int main() { int number1 = 88, number2 = 22; int & refNumber1 = number1; refNumber1 = 11; cout << refNumber1 << endl; refNumber1 = number2; number2++; cout << refNumber1 << endl; cout << number1 << endl; cout << number2 << endl; } O/p:- A.88 23 23 23 B.11 22 22 23 C.11 22 23 23 D.11 23 23 23 E.88 22 22 23
  • 12. Q.14 What will be output when you will execute following c code? #include<stdio.h> void main(){ int a=5; a=a>=4; switch(2){ case 0:int a=8; case 1:int a=10; case 2:++a; case 3:printf("%d",a); } } (A) 2 (B) 10 (C) Compilation error (D)no output
  • 13. Q.15 Which of the following should be used 'if content is not fixed and keep on changing(mutable) but Thread safety is required'? A. String B. StringBuffer C. StringBuilder D. Both B & C Q.16 #include<stdio.h> void main(){ int a=3,b=2; a=a = = b = = 0; switch(a){ case 1:a=a+10; } sizeof(a++); printf("%d",a); } (A)11 (B)12 (C)1 (D)0 Associativity : left to right
  • 14. Q.17 Which of the following concepts means waiting until runtime to determine which function to call? A. Data hiding B. Dynamic casting C. Dynamic binding D. Dynamic loading Q.18 Which of the following are true about the "default" constructor? Choose 2 options: A. It is provided by the compiler only if the class does not define any constructor. B. It initializes the instance members of the class. C. It calls the default 'no-args' constructor of the super class. D. It initializes instance as well as class fields of the class. E. It is provided by the compiler if the class does not define a 'no- args' constructor.
  • 15. Q.19 What will be output when you will execute following c code? #define PRINT printf("Star Wars");printf(" Psycho"); #include<stdio.h> void main(){ int x=1; if(x--) PRINT else printf("The Shawshank Redemption"); } Choose all that apply: (A) Stars Wars Psycho (B) The Shawshank Redemption (C) Warning: Condition is always true (D) Compilation error
  • 16. Q.20 Why reference is not same as a pointer? A. A reference can never be null. B. A reference once established cannot be changed. C. Reference doesn't need an explicit dereferencing mechanism. D. All of the above. Q.21 Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity? A.Insertion Sort B.Quick Sort C.Heap Sort D.Merge Sort Explanation: Both Merge sort and Insertion sort can be used for linked lists. The slow random-access performance of a linked list makes other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible. Since worst case time complexity of Merge Sort is O(nLogn) and Insertion sort is O(n^2), merge sort is preferred.
  • 17. Q.22. A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node should p point such that both the operations enQueue and deQueue can be performed in constant time? A. rear node B. Front node C. not possible with single pointer D. node next to front
  • 18. Q.23 A function f defined on stacks of integers satisfies the following properties. f(∅) = 0 and f (push (S, i)) = max (f(S), 0) + i for all stacks S and integers i. If a stack S contains the integers 2, -3, 2, -1, 2 in order from bottom to top, what is f(S)? A.6 B.4 C.3 D.2 Q.24. In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n internal nodes is: A.nk B.(n-1)k+1 C. n(k-1)+1 D.n(k-1) Q.25. How many distinct binary search trees can be created out of 4 distinct keys? A.4 B.14 C.24 D.42 The base case is t(0) = 1 and t(1) = 1
  • 19. Q.26. What is time complexity of fun()? int fun(int n) { int count = 0; for (int i = n; i > 0; i /= 2) for (int j = 0; j < i; j++) count += 1; return count; } A O(n^2) B.O(nLogn) C.O(n) D. O(nLognLogn)
  • 20. Q.27. class Test { int p = 20; public static void main(String args[]){ final Test t = new Test(); t.p = 30; System.out.println(t.p); } } A.20 B.30 C. Compile time error D. Runtime error
  • 21. Q.28. What will be the result of attempting to compile and run the following program? public class TestClass{ public static void main(String args[ ] ){ String s = "hello"; StringBuilder sb = new StringBuilder( "hello" ); sb.reverse(); s.reverse(); if( s == sb.toString() ) System.out.println( "Equal" ); else System.out.println( "Not Equal" ); } } A. Compilation error. B. It will print 'Equal'. C. It will print 'Not Equal'. D. Runtime error. No reverese method in String.
  • 22. Q.29. Which of the following statements are true? A. For any non-null reference o1, the expression (o1 instanceof o1) will always yield true. B. For any non-null reference o1, the expression (o1 instanceof Object) will always yield true. C. For any non-null reference o1, the expression (o1 instanceof o1) will always yield false. D. For any non-null reference o1, the expression (o1 instanceof Object) may yield false.
  • 23. Q.30 import java.util.*; public class Test { public static void main(String[] args) { TreeSet s = new TreeSet(); s.add(1); s.add(99.9); s.add(99.9); s.add(96.9); for (int i = 0; i < s.size(); i++) { System.out.print(s.pollFirst()+" "); } }} A. 1 96.9 99.9 B.1 96.9 99.9 99.9 C.1 D.compilation error E.an exception is thrown at run time