1. Suppose a C program has floating constant 1.414, what's the best way to convert it as a float data type?
a) (float) 1.414
b) float(1.414)
c) 1.414f or 1.414F
d) None of these
Ans. c
Explanation: By default floating constant is of double data type. By suffixing it with for F, it can be converted to float data type.
2. Consider the following variable declarations and definitions in C
i. int var_9 = 1
ii. int 9_var = 2
iii. int _ = 3
Choose the correct statement w.r.t above variables.
a) Both i) and ii) are valid
b) Only i) is valid
c. Both i) and iii) are valid
d) All of these
Ans. c
Explanation: Rules for naming an identifier
Consists only letters, digits and underscore
Starts only with an alphabet or underscore
Keywords cannot be used. Keywords are reserved.
Can be as long as you like, first 31 characters are significant.
3. For a given integer, which of the following operators can be used to set and reset a particular bit, respectively?
a) | and &
b) && and ||
c) & and |
d) || and &&
Ans. a
Explanation: Bitwise operator | can be used to "set" a particular bit while bitwise operator & can be used to "reset" a particular bit. Please note that && and || are logical operators which evaluate their operands to logical TRUE or FALSE. It should be noted that bitwise operator & can be used for checking a particular bit also i.e. whether a bit is set or not.
4. Let x be an integer which can take a value of 0 or 1. The statement if(x=0) x=1; else x=0; is equivalent to which of the following?
a) x=1+x
b) x=1-x
c) x=x-1
d) x=1%x
Ans. b
5. The maximum number of processes that can be in ready state in computer system with n CPU's is-
a) n
b) n²
c) 2n
d) Independent of n
Ans. d
Explanation: The size of ready queue doesn't depend on number of processes. A single processor system may have a large number of processes waiting in ready queue.
6. Which of the following is not a stable sorting algorithm in its typical implementation?
a) Heap Sort
b) Quick Sort
c) Merge sort
d) Insertion sort
Ans. b
Explanation: Efficient implementations of Quicksort are not a stable sort, meaning that the relative order of equal sort items is not preserved. Quicksort can operate in-place on an array, requiring small additional amounts of memory to perform the sorting
7 . You have to sort 1 GB of data with only 100MB of available main memory. Which sorting technique will be more appropriate?
a) Heap sort
b) Insertion sort
c) Quick sort
d) Merge sort
Ans. d
Explanation: The data can be sorted using external sorting, which uses the merging technique. This can be done as follows:
1. Divide the data into 10 groups, each of size 100.
2. Sort each group and write them to disk.
3. Load 10 items from each group into main memory.
4. Output the smallest item from the main memory to disk. Load the next item from the group whose item was chosen.
5. Loop step #4 until all items are not outputted. The step 3-5 is called as merging technique.
8. Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst-case complexity of sorting n numbers using randomized quicksort?
a) O(n)
b) O(n)²
c) O(n logn)
d) O(n!)
Ans. c
Explanation: Randomized quicksort has expected time complexity as O(nLogn), but worst case time complexity remains same. In worst case the randomized function can pick the index of corner element every time.
9. Consider the following recursive function fun(x,y). What is the value of fun(4,3)?
int fun(int x, int y)
{
if(x==0)
return y;
return fun(x-1,x+y)
}
a) 9
b) 10
c) 12
d)13
Ans. d
10. The average number of key comparisons done in a successful sequential search in a list of length it is
a) log n
b) (n+1)/2
c) (n-1)/2
d) n/2
Ans. b
11. In UNIX, processes that have finished execution but have not yet had their status collected are known as-
a) Sleeping processes
b) Stopped processes
c) Zombie processes
d) Orphan processes
Ans. c
Explanation: Zombie process: By default, the UNIX system assumes that if a child process terminates, the parent process collects some data about the child. As soon as this collection is made, the system releases information bits about the child process and removes its pit from the process table. However, if the parent process fails to collect the child's data, the UNIX is forced to keep the child's pid and termination data in the process table indefinitely. Such a terminated process whose status is not collected is called a zombie process, or simply a zombie
Orphan process: opposite situation to zombie processes. In this a parent process terminates before its child processes. UNIX redefines the "parent PID" field in the child process's data to process init.
12. In UNIX, the login prompt can be changed by changing the content of the file-
a) getydefs
b) contrab
c) initab
d) init
Ans. b
Explanation: Crontab For commands that need to be executed repeatedly (e.g., hourly, daily, or weekly), you can use the crontab command. The crontab command creates a crontab file containing commands and instructions for the cron daemon to execute
13. Which of the following UNIX commands allows scheduling a program to be executed at specifies time?
a) nice
b) cron
c) date and time
d) schedule
Ans. b
Explanation: cron is the daemon responsible for executing scheduled and recurring commands (every day, every week, etc.); atd is that which deals with commands to be executed a single time, but at a specific moment in the future.
14. Which of the following is major part of time taken when accessing data on the disk?
a) Settle time
b) Rotational delay
c) Waiting time
d) Seek time
Ans. d
Explanation: Seek time is time taken by the head to travel to the track of the disk where the data to be accessed is stored.
15. Which of the following programming helps you to learn Android programming?
a) C
b) SQL
c) Java
d) Python
Ans. c
16. Which tool could be used for detecting vulnerability through SQL injection?
a) nmap
b)metasploit
c) bit defender
d) UML
Ans. b
Explanation: Metasploit has several modules that exploit SQL injection vulnerabilities, allowing us to test and verify whether our targets are susceptible to this attack.
17. Which of the following data structures is a non-linear type?
a)Strings
b) Lists
c) Stacks
d) None of these
Ans. d
Explanation: Examples of non-linear data structures are Graphs and Trees. However, Linked lists and Arrays are linear data structures.
18. Which of the following is not a standard synchronous communication protocol?
a) PAS
b) SDLC
c) SLIP
d) SMTP
Ans. a
19. Which of the standard protocol for network management features?
a) FTP
b) SNA
c) SNMP
d) SMTP
Ans. c
20. How many pairs of stations can simultaneously communicate on an Ethernet LAN?
a) 1
b) 2
c)3
d) Multiple
Ans. a
Explanation: only 1 pair of stations can communicate on Ethernet LAN. LAN is defined as local area network. It is used for short distances.
21. A path for carrying signals between a source and a destination is known as -
a) Router
b) Channel
c) Link
d) Block
Ans. b
22. In SQL, the command is used to recompile a view.
a) COMPILE VIEW
b) DEFINE VIEW
c) ALTER VIEW
d) CREATE VIEW
Ans. c
Explanation: The ALTER VIEW command allows you to modify a view
23. Which of the following requires the most time in SDLC?
a) Requirement Analysis
b) Testing
c) Deployment
d) Design
Ans. d
24. Which of the declarations is correct?
a) int length;
b) char int
c)int long:
d) float double;
Ans. a
25. POP3 is a protocol for-
a) Email Sending
b) Email Composing
c) Email Receiving
d) Email Storing
Ans. c
26. Which server can you use to dynamically assign IP addresses to the PCs in a LAN?
a) DHCP Server
b) Web Server
c) DNS Server
d) FTP Server
Ans. a
Explanation: DHCP is an abbreviation Dynamic Host Configuration Protocol. It is an application-layer protocol used by hosts for obtaining network setup information. The DHCP is controlled by a DHCP server that dynamically distributes network configuration parameters such as IP addresses, subnet mask, and gateway address.
27. The operator that cannot be overloaded is -
(a) ++
b) ()
(c) ~
d) ::
Ans. d
28. Which of the following is the destructor of class Vehicle?
a) *Vehicle0
b) ~Vehicle()
c) ~Vehicle(int value)
d)*Vehicle(int value)
Ans. b
29. An n*n array v is defined as follows: v[i, j] = i - j for all i, j; 1 <= i <= n, 1 <= j <= n. The sum of the elements of the array v is
a) 0
b) n-1
c) n²-3n+2
d) n²(n+1)/2
Ans. a
30. The maximum number of binary trees that can be formed with three unlabeled nodes is-
a) 1
b) 3
c) 5
d) 4
Ans. c
Explanation: We can find the number of binary trees by:
Here n = 3,
Number of binary trees = (2nCn)/n+1 = (2*3C3)/4+1=5.
31. What is the time complexity of Huffman coding?
a) O(n)
b) O(n log n)
c) O(n (log n)^2)
d) O(n^2)
Ans. b
Explanation: The time complexity of the Huffman algorithm is O(n log n).
32. Which of the following TCP/IP addresses constitutes the loopback address?
a) 1.1.1.1
b) 255.255.255.255
c) 127.0.0.0
d) 127.0.0.1
Ans. d
Explanation: A loopback address is a type of IP address that is used to test the communication or transportation medium on a local network card and/or for testing network applications. Data packets sent on a loopback address are rerouted back to the originating node without any alteration or modification.
33. Which of the following operator functions cannot be global, i.e, must be a member function?
a) Conversion operator
b) new
c) delete
d) all of these
Ans. a
34. Which of the following is not an operator in Java?
a) instanceof
b) sizeof
c) new
d) All of this
Ans. b
Explanation: There is no sizeof operator in Java. We generally don't need size of objects
35. Find the output of the following Java code line: System.out.println(math.floor(-7.4)
a)-7
b)-7.4
c)-8
d) -7.2
Ans. c
Explanation:
public class FloorCeilTest {
public static void main(String args[]) {
double d1 = 84.6;
double d2 = -7.4;
System.out.println("Ceiling of '" + d1 + "' = " +
Math.ceil(d1));
System.out.println("Floor of '" + d1 + "' = " +
Math.floor(d1));
System.out.println("Ceiling of '" + d2 + "' = " +
Math.ceil(d2));
System.out.println("Floor of '" + d2 + "' = " +
Math.floor (d2));)}
Output:
Ceiling of '84.6' = 85.0
Floor of '84.6' = 84.0
Ceiling of '-7.4' = -7.0
Floor of '-7.4' = -8.0
36. Which functions overload the >> operator?
a) gt()
b) more()
c) ge()
d) None of this
Ans. d
Explanation: rshift() overloads the >> operator
37. What is the output of the following code? Print 9//12
a) 4
b) 0
c) 4.5
d) Error
Ans. b
Explanation: The '//' operator in Python returns the integer part of the floating number. In python: 10/3 = 3.333 and 10//3 =3
38. Which of these is not a core data type?
a) Lists
b) Dictionary
c) Class
d) Tuples+95
Ans. c
Explanation: Class is a user-defined data type.
39. Which of the following functions converts a string into a float in Python?
a) int(x[.base])
b) float(x)
c) long(x[,base])
d) str(x)
Ans. b
Explanation: float(x) - Converts x to a floating-point number
40. Which of the following process scheduling algorithms may lead to starvation?
a) FIFO
b) Round Robin
c) Shortest Job Next
d) None of these
Ans. c
Explanation: the shortest job next may lead to process starvation for processes that will require a long time to complete if short processes are continually added
>>>