SlideShare a Scribd company logo
3
Most read
6
Most read
19
Most read
Walchand College Of Engineering,Sangli
ORGANIZES
Technical Aptitude Test
ASSOCIATION of Computer Science & Engg. STUDENTS
Date:21 July,2015
By Sujata Regoti
1.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
E x p l a n a t i o n :
We can not declare any variable in any case of switch case
statement.
1
2.What is the infix version of the following postfix expression?
x 12 + z 17 y + 42 * / +
A. (x + 12 + z) / (17 + y * 42)
B. x + 12 + z / 17 + y * 42
C. x + 12 + z / (17 + y) * 42
D. x + 12 + z / ((17 + y) * 42)
E. x + (12 + z) / (17 + y * 42)
2
3. If we use mergesort to sort an array with n elements, what
is the worst case time required for the sort?
A. O(1)
B. O(log n)
C. O(n)
D. O(n log n)
E. O(n2)
1
4.Output of following C++ code is
int &check()
{
static int num = 30;
return num;
}
int main()
{
check () = 40;
cout << check ();
return 0;
}
A.Compiler Error: lvalue required
B.40
C.30
D.0
Exp: When a function returns by reference, it can be used as lvalue. Since x
is a static variable, every call to fun() will not assign 30
1
5.Output of following C++ code is (consider int 4 bytes)
#include <stdio.h>
int cse;
int main()
{
struct cse { double x; };
printf("%d", sizeof(cse));
return 0;
}
A. 8
B. 2
C. 4
D. Compiler error
Expl : In cpp struct keyword not required to use with variable name. So cse
hides global variable cse
1
6 .What is output of following C++ code
#include<iostream>
class Test {
public :
int s;
Test(int s){
this->s=s;
}
static Test & fun() {
return this; }
};
int main()
{
Test t1(20),t2(30);
t2=t1.fun();
std::cout << t2.s;
}
A.20
B. Compilation error
C.30
D. Runtime error
//error: this is unavailable for static member functions
1
7.What is the output for the below java code ?
public class Test{
int _$;
int $7;
int do;
public static void main(String argv[]){
Test test = new Test();
test.$7=7;
test.do=9;
System.out.println(test.$7);
System.out.println(test.do);
System.out.println(test._$);
}
}
A.7 9 0
B.7 0 0
C.Compile error - $7 is not valid identifier.
D.Compile error - do is not valid identifier.
Expl: do is keyword
1
8. What is expected output
public class Test{
public static void main(String[] args) {
String s=null;
System.out.println(null+s);
}
}
A.Runtime Exception thrown
B.null
C.nullnull
D.Compiler error
1
9.What is expected output
public static void main(String[] args)
{
String s="";
StringBuffer sb="";
int i=5;
if(i<0)
s.concate("java rock");
else
sb.append("java rock");
System.out.println(s+sb);
}
A.javarock
B.javarock javarock
C.Compilation error
D.No output
E.Runtime error
Exp. :We cant directly assign string to stringbuffer So Error :incompatible
types at Line StringBuffer sb=“”; It should be sb=new StringBuffer(“”);
2
10. How can this program be modified to make use of appropriate generic
types? (one modification for each line)
//Choose 3 options
import java.util.*;
public class Test {
public static void main(String[] args) {
List ids = new ArrayList(); // Line 1
ids.add(123);
ids.add(999);
Map students = new HashMap(); // Line 2
students.put("Jess",ids.get(0));
students.put("Jimmy",ids.get(1));
int x = ((Long)students.get("Jimmy")).intValue(); // Line3
}
}
A. replace line 1 with List<Integer> ids = new ArrayList<Integer>();
B. replace line 1 with List<Long> ids = new ArrayList<Long>();
C. replace line 2 with Map<Integer,String> students = new
HashMap<Integer,String>();
D. replace line 2 with Map<String,Integer> students = new
HashMap<String,Integer>();
E. replace line 3 with int x = students.get("Jimmy");
2
11. class Test
{
public static void main(String[] args) {
Integer i = new Integer(0);
Float f = new Float(0);
System.out.println(i==f);
System.out.println(i.equals(f));
}
}
O/p is:
A. true false
B. false true
C. true true
D. Compiler error
Explanation :error: incomparable types:Integer and Float
1
12. Which of the following are not a valid declarations?
A. float f = 1;
B. float f = 1.2f;
C. float f = 1.2;
D. float f = (float)1.2;
Explanation : By Default real number is double which cant be
directly assigned to float . So 3rd declaration throws error :
possible loss of precision occur.
1
13. A process executes the code
fork();
fork();
fork();
The total number of child processes created is
A. 8
B. 7
C. 6
D. 3
2
14.Which of the following memory allocation scheme suffers from
external fragmentation ?
A. Segmentation
B. Pure demand paging
C. Swapping
D. Paging
Explanation :
External fragmentation occurs in systems that use pure
segmentation.Because each segment has varied size to fit each program
size, the holes (unused memory) occur external to the allocated memory
partition.
1
15.Which of the following concurrency control protocols ensure both
conflict serializability and freedom from deadlock?
I. 2-phase locking
II. Time-stamp ordering
A. I only
B. II only
C. Both I and II
D. Neither I nor II
2 Phase Locking (2PL) is a concurrency control method that guarantees
serializability. The protocol utilizes locks, applied by a transaction to data,
which may block (interpreted as signals to stop) other transactions from
accessing the same data during the transaction’s life. 2PL may be lead to
deadlocks that result from the mutual blocking of two or more transactions.
See the following situation, neither T3 nor T4 can make progress.
Timestamp-based concurrency control algorithm is a non-lock concurrency
control method. In Timestamp based method, deadlock cannot occur as no
transaction ever waits.
1
16.Consider the following relational schema:
Employee (empId, empName, empDept )
Customer (custId,custName, salesRepId, rating)
SalesRepId is a foreign key referring to empId of the employee relation.
Assume that each employee makes a sale to at least one customer. What
does the following query return?
SELECT empName
FROM Employee E
WHERE NOT EXISTS (SELECT custId
FROM customer C
WHERE C. salesRepId = E. empId
AND C. rating < > ‘GOOD’)
A. Names of all the employees with at least one of their customers having a
‘GOOD’ rating.
B. Names of all the employees with at most one of their customers having a
‘GOOD’ rating.
C. Names of all the employees with none of their customers having a
‘GOOD’ rating.
D. Names of all the employees with all their customers having a ‘GOOD’
rating.
2
16. Explanation
The outer query will return the value (names of employees) for a tuple in
relation E, only if
inner query for that tuple will return no tuple (usage of NOT EXISTS).
The inner query will run for every tuple of outer query. It selects cust-id for
an employee e, if
rating of customer is NOT good. Such an employee should not be selected
in the output of
outer query.
So the query will return the names of all those employees whose all
customers have GOOD
rating.
2
17.Consider different activities related to email.
m1:Send an email from a mail client to mail server
m2:Download an email from mailbox server to a mail client
m3:Checking email in a web browser
Which protocol is applicable in each activity?
A. m1:HTTP, m2:SMTP, m3:POP
B. m1:SMTP, m2:FTP, m3:HTTP
C. m1:SMTP, m2:POP, m3:HTTP
D. m1:POP, m2:SMTP, m3:IMAP
Simple Mail Transfer Protocol (SMTP) is typically used by user clients for
sending mails.
Post Office Protocol (POP) is used by clients for receiving mails.
Checking mails in web browser is a simple HTTP process.
1
18. A layer-4 firewall ( a device that can look at all protocol headers up to
the transport layer) CANNOT
A. block HTTP traffic during 9:00PM and 5:00AM
B. block all ICMP traffic
C. stop incoming traffic from a specific IP address but allow outgoing
traffic to same IP
D. block TCP traffic from a specific user on a specific IP address on multi-
user system during 9:00PM and 5:00AM
Exp: HTTP is an application layer protocol. Since firewal is at layer 4, it
cannot block HTTP data.
1
19.Consider the following languages over the alphabet S = {0,1,c}
L1={ 0^n 1^n | n>=0}
L2={wcw^r |w ∈ {0,1}*}
L3={ww^r |w ∈ {0,1}*}
Here w^r is the reverse of the string w. Which of these languages are
deterministic Context free languages?
A. None of the languages
B. Only L1
C. Only L1 and L2
D. All the three languages
Exp:For the languages L1 and L2 we can have deterministic push down
automata, so they are
DCFL’s, but for 3 L only non-deterministic PDA possible. So the language
L3 is not a deterministic CFL.
1
20.The number of states in the minimal deterministic finite
automaton corresponding to the regular expression (0+1)*(10)
is
A. One
B. Three
C. Four
D. Two
1

More Related Content

PPTX
Exception Handling in object oriented programming using C++
PDF
Issues in the design of Code Generator
DOCX
Practical File of C Language
PDF
Object Oriented Programming Using C++ Practical File
PPTX
GUI components in Java
PPTX
Control and conditional statements
PPT
MYSQL - PHP Database Connectivity
PDF
C multiple choice questions and answers pdf
Exception Handling in object oriented programming using C++
Issues in the design of Code Generator
Practical File of C Language
Object Oriented Programming Using C++ Practical File
GUI components in Java
Control and conditional statements
MYSQL - PHP Database Connectivity
C multiple choice questions and answers pdf

What's hot (20)

PPTX
Instruction level parallelism
PPTX
PHP FUNCTIONS
PPTX
Chess board problem(divide and conquer)
PPTX
Presentation on C Switch Case Statements
PDF
Data Structures Practical File
PPTX
Java exception handling
DOCX
Oops practical file
PPT
Chapter 2 Representation Of Algorithms 2
PPTX
Daa unit 5
PPTX
Loops in C Programming Language
PPTX
Variables and Data Types
PPTX
Type casting in c programming
PPT
Java interfaces
PDF
chapter 2 architecture
PPTX
Templates in C++
PDF
Intermediate code generation in Compiler Design
PPTX
Getters_And_Setters.pptx
PPT
02 c++ Array Pointer
PDF
Introduction to c++ ppt 1
PPT
Variables in C Programming
Instruction level parallelism
PHP FUNCTIONS
Chess board problem(divide and conquer)
Presentation on C Switch Case Statements
Data Structures Practical File
Java exception handling
Oops practical file
Chapter 2 Representation Of Algorithms 2
Daa unit 5
Loops in C Programming Language
Variables and Data Types
Type casting in c programming
Java interfaces
chapter 2 architecture
Templates in C++
Intermediate code generation in Compiler Design
Getters_And_Setters.pptx
02 c++ Array Pointer
Introduction to c++ ppt 1
Variables in C Programming
Ad

Similar to Technical aptitude Test 1 CSE (20)

PPTX
Chapter 3 of Java 17 Certification sample questions
DOCX
Technical questions
PDF
C++ Certified Associate Programmer CPA
DOCX
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
PDF
Aptitute question papers in c
PDF
Scjp6.0
PPT
operators.ppt
PDF
Starting Out with C++ from Control Structures to Objects 8th Edition Gaddis T...
PPTX
Java Quiz
PPTX
Technical aptitude test 2 CSE
PPTX
C Programming Unit-2
PDF
cuptopointer-180804092048-190306091149 (2).pdf
PDF
Mid term sem 2 1415 sol
PPTX
Programming in C Presentation upto FILE
DOCX
Looping statements
DOCX
C __paper.docx_final
DOCX
Qust & ans inc
PDF
C language questions_answers_explanation
DOCX
Programming in c
DOC
Chapter 3 of Java 17 Certification sample questions
Technical questions
C++ Certified Associate Programmer CPA
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Aptitute question papers in c
Scjp6.0
operators.ppt
Starting Out with C++ from Control Structures to Objects 8th Edition Gaddis T...
Java Quiz
Technical aptitude test 2 CSE
C Programming Unit-2
cuptopointer-180804092048-190306091149 (2).pdf
Mid term sem 2 1415 sol
Programming in C Presentation upto FILE
Looping statements
C __paper.docx_final
Qust & ans inc
C language questions_answers_explanation
Programming in c
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)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Well-logging-methods_new................
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
additive manufacturing of ss316l using mig welding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Sustainable Sites - Green Building Construction
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Well-logging-methods_new................
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Geodesy 1.pptx...............................................
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
additive manufacturing of ss316l using mig welding
Mechanical Engineering MATERIALS Selection
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Sustainable Sites - Green Building Construction
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Embodied AI: Ushering in the Next Era of Intelligent Systems
Arduino robotics embedded978-1-4302-3184-4.pdf
Internet of Things (IOT) - A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf

Technical aptitude Test 1 CSE

  • 1. Walchand College Of Engineering,Sangli ORGANIZES Technical Aptitude Test ASSOCIATION of Computer Science & Engg. STUDENTS Date:21 July,2015 By Sujata Regoti
  • 2. 1.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 E x p l a n a t i o n : We can not declare any variable in any case of switch case statement. 1
  • 3. 2.What is the infix version of the following postfix expression? x 12 + z 17 y + 42 * / + A. (x + 12 + z) / (17 + y * 42) B. x + 12 + z / 17 + y * 42 C. x + 12 + z / (17 + y) * 42 D. x + 12 + z / ((17 + y) * 42) E. x + (12 + z) / (17 + y * 42) 2
  • 4. 3. If we use mergesort to sort an array with n elements, what is the worst case time required for the sort? A. O(1) B. O(log n) C. O(n) D. O(n log n) E. O(n2) 1
  • 5. 4.Output of following C++ code is int &check() { static int num = 30; return num; } int main() { check () = 40; cout << check (); return 0; } A.Compiler Error: lvalue required B.40 C.30 D.0 Exp: When a function returns by reference, it can be used as lvalue. Since x is a static variable, every call to fun() will not assign 30 1
  • 6. 5.Output of following C++ code is (consider int 4 bytes) #include <stdio.h> int cse; int main() { struct cse { double x; }; printf("%d", sizeof(cse)); return 0; } A. 8 B. 2 C. 4 D. Compiler error Expl : In cpp struct keyword not required to use with variable name. So cse hides global variable cse 1
  • 7. 6 .What is output of following C++ code #include<iostream> class Test { public : int s; Test(int s){ this->s=s; } static Test & fun() { return this; } }; int main() { Test t1(20),t2(30); t2=t1.fun(); std::cout << t2.s; } A.20 B. Compilation error C.30 D. Runtime error //error: this is unavailable for static member functions 1
  • 8. 7.What is the output for the below java code ? public class Test{ int _$; int $7; int do; public static void main(String argv[]){ Test test = new Test(); test.$7=7; test.do=9; System.out.println(test.$7); System.out.println(test.do); System.out.println(test._$); } } A.7 9 0 B.7 0 0 C.Compile error - $7 is not valid identifier. D.Compile error - do is not valid identifier. Expl: do is keyword 1
  • 9. 8. What is expected output public class Test{ public static void main(String[] args) { String s=null; System.out.println(null+s); } } A.Runtime Exception thrown B.null C.nullnull D.Compiler error 1
  • 10. 9.What is expected output public static void main(String[] args) { String s=""; StringBuffer sb=""; int i=5; if(i<0) s.concate("java rock"); else sb.append("java rock"); System.out.println(s+sb); } A.javarock B.javarock javarock C.Compilation error D.No output E.Runtime error Exp. :We cant directly assign string to stringbuffer So Error :incompatible types at Line StringBuffer sb=“”; It should be sb=new StringBuffer(“”); 2
  • 11. 10. How can this program be modified to make use of appropriate generic types? (one modification for each line) //Choose 3 options import java.util.*; public class Test { public static void main(String[] args) { List ids = new ArrayList(); // Line 1 ids.add(123); ids.add(999); Map students = new HashMap(); // Line 2 students.put("Jess",ids.get(0)); students.put("Jimmy",ids.get(1)); int x = ((Long)students.get("Jimmy")).intValue(); // Line3 } } A. replace line 1 with List<Integer> ids = new ArrayList<Integer>(); B. replace line 1 with List<Long> ids = new ArrayList<Long>(); C. replace line 2 with Map<Integer,String> students = new HashMap<Integer,String>(); D. replace line 2 with Map<String,Integer> students = new HashMap<String,Integer>(); E. replace line 3 with int x = students.get("Jimmy"); 2
  • 12. 11. class Test { public static void main(String[] args) { Integer i = new Integer(0); Float f = new Float(0); System.out.println(i==f); System.out.println(i.equals(f)); } } O/p is: A. true false B. false true C. true true D. Compiler error Explanation :error: incomparable types:Integer and Float 1
  • 13. 12. Which of the following are not a valid declarations? A. float f = 1; B. float f = 1.2f; C. float f = 1.2; D. float f = (float)1.2; Explanation : By Default real number is double which cant be directly assigned to float . So 3rd declaration throws error : possible loss of precision occur. 1
  • 14. 13. A process executes the code fork(); fork(); fork(); The total number of child processes created is A. 8 B. 7 C. 6 D. 3 2
  • 15. 14.Which of the following memory allocation scheme suffers from external fragmentation ? A. Segmentation B. Pure demand paging C. Swapping D. Paging Explanation : External fragmentation occurs in systems that use pure segmentation.Because each segment has varied size to fit each program size, the holes (unused memory) occur external to the allocated memory partition. 1
  • 16. 15.Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock? I. 2-phase locking II. Time-stamp ordering A. I only B. II only C. Both I and II D. Neither I nor II 2 Phase Locking (2PL) is a concurrency control method that guarantees serializability. The protocol utilizes locks, applied by a transaction to data, which may block (interpreted as signals to stop) other transactions from accessing the same data during the transaction’s life. 2PL may be lead to deadlocks that result from the mutual blocking of two or more transactions. See the following situation, neither T3 nor T4 can make progress. Timestamp-based concurrency control algorithm is a non-lock concurrency control method. In Timestamp based method, deadlock cannot occur as no transaction ever waits. 1
  • 17. 16.Consider the following relational schema: Employee (empId, empName, empDept ) Customer (custId,custName, salesRepId, rating) SalesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM Employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C. salesRepId = E. empId AND C. rating < > ‘GOOD’) A. Names of all the employees with at least one of their customers having a ‘GOOD’ rating. B. Names of all the employees with at most one of their customers having a ‘GOOD’ rating. C. Names of all the employees with none of their customers having a ‘GOOD’ rating. D. Names of all the employees with all their customers having a ‘GOOD’ rating. 2
  • 18. 16. Explanation The outer query will return the value (names of employees) for a tuple in relation E, only if inner query for that tuple will return no tuple (usage of NOT EXISTS). The inner query will run for every tuple of outer query. It selects cust-id for an employee e, if rating of customer is NOT good. Such an employee should not be selected in the output of outer query. So the query will return the names of all those employees whose all customers have GOOD rating. 2
  • 19. 17.Consider different activities related to email. m1:Send an email from a mail client to mail server m2:Download an email from mailbox server to a mail client m3:Checking email in a web browser Which protocol is applicable in each activity? A. m1:HTTP, m2:SMTP, m3:POP B. m1:SMTP, m2:FTP, m3:HTTP C. m1:SMTP, m2:POP, m3:HTTP D. m1:POP, m2:SMTP, m3:IMAP Simple Mail Transfer Protocol (SMTP) is typically used by user clients for sending mails. Post Office Protocol (POP) is used by clients for receiving mails. Checking mails in web browser is a simple HTTP process. 1
  • 20. 18. A layer-4 firewall ( a device that can look at all protocol headers up to the transport layer) CANNOT A. block HTTP traffic during 9:00PM and 5:00AM B. block all ICMP traffic C. stop incoming traffic from a specific IP address but allow outgoing traffic to same IP D. block TCP traffic from a specific user on a specific IP address on multi- user system during 9:00PM and 5:00AM Exp: HTTP is an application layer protocol. Since firewal is at layer 4, it cannot block HTTP data. 1
  • 21. 19.Consider the following languages over the alphabet S = {0,1,c} L1={ 0^n 1^n | n>=0} L2={wcw^r |w ∈ {0,1}*} L3={ww^r |w ∈ {0,1}*} Here w^r is the reverse of the string w. Which of these languages are deterministic Context free languages? A. None of the languages B. Only L1 C. Only L1 and L2 D. All the three languages Exp:For the languages L1 and L2 we can have deterministic push down automata, so they are DCFL’s, but for 3 L only non-deterministic PDA possible. So the language L3 is not a deterministic CFL. 1
  • 22. 20.The number of states in the minimal deterministic finite automaton corresponding to the regular expression (0+1)*(10) is A. One B. Three C. Four D. Two 1