Computer Sciece Mock Exit Exam
Computer Sciece Mock Exit Exam
A.5
B.4
C.7
D.6
ANSWER: D
Which loop structure is suitable when the number of iterations is known in advance?
A.do-while loop
B. while loop
C. for loop
D. switch statement
ANSWER: C
What is the purpose of a function prototype in C++?
A. To define the body of a function
B. To declare the existence of a function
C. To specify the return type of a function
D. To provide the input parameters for a function
ANSWER: B
What is the output of the following code snippet?
A.10
B.20
C. Compiler error
D. Runtime error
ANSWER: B
One of the following is NOT true?
A. when the result of condition is true in if else, the body of the else statement is never executed
B. when result of condition is false, the body of the if statement is executed
C. case keyword is used to identify possible entry points of switch statement
D. In do while, its body is executed first and then the loop condition is examined
ANSWER: B
How many times will the following loop execute?
A. 3
B. 5
C. 4
D. 6
ANSWER: C
Which of the following best describes the difference between a static method and an instance method
in Java?
A. Instance methods can be accessed without creating an instance of the class, whereas static methods
are accessed through an object of the class
B. Static methods are called by other methods, whereas instance methods are called by the main()
method
C. Instance methods are used for performing calculations, whereas static methods are used for
input/output operations
D. Static methods can be accessed without creating an instance of the class, whereas instance methods
are accessed through an object of the class
ANSWER: D
Which feature of OOP is indicated by the following code?
A.0
B.1
C. Compilation Error
D. Runtime Error
ANSWER: B
In which access should a constructor be defined, so that object of the class can be created in any
function?
A. Any access specifier will work
B. Private
C. Public
D. Protected
ANSWER: C
Runtime polymorphism feature in java is
A. Method overriding
B. Method overloading
C. Operator overloading
D. Constructor overloading
ANSWER: A
In a frame-based knowledge representation system, what does the term "attribute" refer to?
A.A characteristic of a frame that defines its relationship to other frames.
B.A property of a frame that describes its properties or characteristics.
C. The frame's location in a hierarchical structure.
D. The rule that relates a frame to other frames.
ANSWER: B
Which of the following situations incorporates the application of reinforcement learning?
A. Educating a chatbot to interpret and interact with user inquiries.
B. Examining customer data to recognize market segments.
C. Instructing a robot to traverse a maze and determine the most efficient route.
D. Grouping news articles according to their content characteristics.
ANSWER: C
Which learning approach is commonly used when the target variable is numerical?
A. Classification
B. Regression
C. Clustering
D. Reinforcement Learning
ANSWER: B
In AI, if agent knows exactly about the state, the problem type is?
A. Single-state problem
B. Conformant problem
C. Exploration problem
D. Contingency problem
ANSWER: A
Which of the following exemplifies Association Mining?
A. Predicting stock prices.
B. Categorizing emails as spam or non-spam.
C. Recommending products to customers using their purchase history.
D. Analysing the sentiment expressed in customer reviews.
ANSWER: C
Which of the following is an advantage of using informed search strategies in search problems and
games?
A. They guarantee finding the optimal solution.
B. They are always faster than uninformed search strategies.
C. They can use domain-specific knowledge to guide the search.
D. They are less complex than uninformed search strategies.
ANSWER: C
What is the primary purpose of HyperText Markup Language (HTML) in web development?
A. To add interactivity to web pages
B. To define the structure and content of web pages
C. To handle communication between server and client
D. To create animations and graphics
ANSWER: B
When encountering a JavaScript error message, the first step in debugging should be:
A. Ignoring the error and hoping it goes away
B. Re-writing the entire code from scratch
C. Reading the error message carefully and identifying the line causing the issue
D. Searching online for generic solutions without understanding the context
ANSWER: C
A client wants a website showcasing their photography portfolio. They have hundreds of high-
resolution images. How would you optimize the website's content management and user experience
for these images?
A. Display all images in full resolution on a single page, potentially causing slow loading
times.
B. Use a single, large image file containing all photos.
C. Implement a database to manage image information and utilize thumbnails for browsing
with options to view full-size versions on demand.
D. Upload all images directly into HTML code.
ANSWER: C
You are tasked with creating a website for a news organization with daily content updates. How
would you ensure efficient content management and user experience for readers?
A. Create static HTML pages for each news article, requiring manual updates for new content.
B. Develop a content management system (CMS) allowing for easy content creation, editing, and
organization for a dynamic website.
C. Rely on users to submit news articles directly through HTML forms, leading to potential quality
and security issues.
D. Use a single, long webpage with all news articles listed chronologically, making navigation
challenging for older content.
ANSWER: B
When designing a client-server system with multiple clients accessing the server concurrently, what
concurrency control mechanism would be most effective in preventing data inconsistencies?
A.No concurrency control
B.Hyperlinks: Used for linking web pages
C.Cookies: Used for client-side state management.
D.Semaphores: Signaling mechanism for controlling access to shared resources, a viable
option.
ANSWER: D
When designing the communication protocol for a client-server system, which element is MOST
crucial for ensuring data integrity and security?
A. Using clear and concise language in the protocol specifications.
B. Defining the format and structure of data messages.
C. Implementing data encryption and authentication mechanisms to protect sensitive
information.
D. Specifying error codes for various communication failures.
ANSWER: C
You're designing a website for a local museum with a vast collection of artifacts. Users should be able
to search for specific artifacts based on criteria like category, date, or artist. Which approach would be
most effective in managing this content for efficient searching and display?
A. Create individual web pages for each artifact, making searching cumbersome.
B. Store all artifact information in a single, long webpage, leading to poor user experience.
C. Develop a database to store artifact information and use server-side scripting to
dynamically generate search results and detailed pages for each artifact.
D. Rely solely on client-side search functionality within the browser for efficiency
ANSWER: C
A user submits a form on your website. Which combination of technologies best represents how the
form data would be processed for server-side validation and storage?
A.Client-side validation with JavaScript and server-side processing using HTML forms.
B.Only client-side validation with JavaScript for a more responsive experience.
C.Only server-side validation to avoid user manipulation of data.
D.Client-side validation with JavaScript, but storing data directly in the browser for security
reasons.
ANSWER: A
A user clicks a button on your webpage. How can you use client-side scripting (JavaScript) to
enhance the user experience without requiring a full page reload?
A.The button should submit a form to the server for processing.
B.Use JavaScript to handle the button click event and perform actions like displaying
animations or updating content dynamically on the page.
C.Re-render the entire page using JavaScript to simulate interactivity.
D.Client-side scripting cannot handle button clicks without server interaction.
ANSWER: B
Which of the following data structures can be used to reverse the order of set of data items?
A.Queue
B.Stack
C.Linked list
D.Heap
ANSWER: B
Which of the following operations is performed more efficiently by doubly linked list than by singly
linked list?
A. Deleting a node whose location in given
B. Searching of an unsorted list for a given item
C. Inverting a node after the node with given location
D. Traversing a list to process each node
ANSWER: A
For the linked list implementation of the queue, where are the enqueue and dequeues performed?
A. Enqueue in front of the first element, dequeue the first element
B. Enqueue after the last element, dequeue the last element
C. Enqueue after the last element, dequeue the first element
D. Enqueue after the first element, dequeue the last element
ANSWER: C
The disadvantage in using a circular linked list is?
A.It is possible to get into infinite loop
B.Last node points to first node.
C.Time consuming
D.Requires more memory space
ANSWER: C
In algorithm analysis, what does asymptotic complexity refer to?
A. The complexity in the best case
B. The complexity in the worst case
C. The complexity in the average case
D. The behavior of an algorithm as the input size grows
ANSWER: C
Which data structure is most efficient for implementing a priority queue?
A.Binary search tree
B.Hash table
C.Binary heap
D.Linked list
ANSWER: C
A structure definition is a user-defined variable type which is a grouping of one or
more variables. Which one of the following is not correct about structure?
A.Once the type has been defined through the C++ ‘struct’ keyword, you can create variables from it
just like you would any other type.
B.After creating a structure variable you must create a structure definition.
C.The structure definition is a listing of all member variables with their types and names.
D.Defining a structure is giving the compiler a blueprint for creating your type.
ANSWER: B
In a min-heap, the minimum element can be found in
A.O(n)
B.O(log n)
C.O(n log n)
D.O(1)
ANSWER: D
Which algorithm is used to find all pairs shortest paths in a graph?
A.Dijkstra's Algorithm
B.Bellman-Ford Algorithm
C.Floyd-Warshall Algorithm
D.Kruskal's Algorithm
ANSWER: C
Which of the following is NOT an advantage of using backtracking algorithms?
A.To solve problem in which a sequence of object is chosen from a specified set
B.They always find the optimal solution
C.They can be easily implemented using recursion
D.They can solve constraint satisfaction problems
ANSWER: B
The recurrence relation for the Merge Sort algorithm is:
A.T(n) = 2T(n/2) + O(n)
B.T(n) = T(n/2) + O(n)
C.T(n) = 2T(n/2) + O(1)
D.T(n) = T(n-1) + O(n)
ANSWER: A
Which of the following is not a characteristic of a greedy algorithm?
A.It makes a locally optimal choice at each step
B.It guarantees a globally optimal solution for all problems
C.It is used in problems like the minimum spanning tree
D.It is generally easier to implement than dynamic programming
ANSWER: A
What is the time complexity of searching for an element in a hash table with n elements and m slots,
assuming no collisions?
A.O(n)
B.O(m)
C.O(1)
D.O(n log n)
ANSWER: C
Which of the following is a potential disadvantage of using threads over processes?
A .Increased concurrency
B. Reduced memory usage
C. Improved fault isolation
D. Increased complexity in synchronization
ANSWER: D
Which of the following memory management techniques allows the operating system to load only the
necessary portions of a program into memory at a given time?
A. Demand paging
B. Segmentation
C. Paging
D. Virtual memory
ANSWER: A
Which of the following mutual exclusion solutions is considered the most efficient in terms of
minimizing the number of context switches?
A. Semaphore-based solution
B. Message-passing-based solution
C. Spin-lock-based solution
D. Monitor-based solution
ANSWER: C
When evaluating the suitability of preemptive and non-preemptive scheduling algorithms for real-time
systems, which of the following is the most important consideration?
A. Fairness in resource allocation
B. Responsiveness and ability to meet deadlines
C. Simplicity of implementation
D. Overall system throughput
ANSWER: B
Which of the following is the primary advantage of non-preemptive scheduling algorithms over
preemptive algorithms?
A. Improved real-time performance
B. Reduced task starvation
C. Simpler implementation and reduced overhead
D. Better support for dynamic workloads
ANSWER: C
Which of the following is the most effective way to prevent deadlocks in a computer system?
A. Avoid the Hold and Wait condition
B. Prevent Circular Wait
C. Eliminate the Mutual Exclusion condition
D. Ensure No Preemption
ANSWER: B
What is the role of the instruction decode (ID) stage in pipelining?
A. To execute the instruction
B. To write the result back to the register
C. To fetch the instruction from memory
D. To translate the instruction into signals for the other stages
ANSWER: C
Which one of the following circuits requires memory to store the state of the output?
A. Combinational circuit
B. Sequential circuits
C. Logical circuit
D. Physical circuit
ANSWER: B
How does the CPU's control unit coordinate the execution of instructions?
A. The control unit manages the allocation and translation of virtual memory addresses to physical
memory addresses.
B. The control unit retrieves instructions from memory, interprets them, and then coordinates the
execution of those instructions.
C. The control unit provides connectivity and integration for the computer's components.
D. The control unit manages input/output operations.
ANSWER: B
Which of the following circuit is used to store one bit of data?
A. Decoder
B. Encoder
C. Flip Flop
D. Register
ANSWER: D
What characteristic of RAM memory makes it not suitable for permanent storage?
A. too slow
B. unreliable
C. it is volatile
D. too bulky
ANSWER: C
In computers, subtraction is generally carried out by
A. 9's complement
B. 10's complement
C. 1'scomplement
D. 2's complement
ANSWER: D
What is the language and grammar accepted by pushdown automata?
A. Regular language and type-3 grammar
B. Context-free language and type-2 grammar
C. Context-free language and type-3 grammar
D. Context-sensitive language and type-1 grammar
ANSWER: B
Which one of the following languages over the alphabet {0, 1} is described
by the regular expression: (0+1)*0(0+1)*0(0+1)*?
A. The set of all strings containing the substring 00
B. The set of all strings containing at most two 0’s
C. The set of all strings containing at least two 0’s
D. The set of all strings that begin and end with either 0 and 1
ANSWER: C
Which of the following is the most powerful type of machine?
A.Deterministic finite automata (DFA)
B.Non-deterministic finite automata (NFA)
C.Turing machine
D. Pushdown automata
ANSWER: C
The Kleene star operation "*" in regular expressions represents:
A. Concatenation
B. Union
C. One or more repetitions
D. Zero or more repetitions
ANSWER:D
Regular expression for all strings starts with 01 and ends with 110 is.
A.010*1*110
B. 01(01)*110
C. 01(0+1)*110
D.01110
ANSWER: C
Which complexity class represents decision problems that can be solved by a deterministic Turing
Machine in polynomial time?
A.P
B.NP
C. Co-NP
D.PSPACE
ANSWER: A
Which of the following statements about context-free grammars is true?
A. They are more powerful than regular expressions.
B. They are less powerful than regular expressions.
C. They are equivalent in power to regular expressions.
D. They cannot be used to describe programming languages.
ANSWER: A
Which data structure is typically used to implement a symbol table in a compiler?
A. Linked List
B. Stack
C. Queue
D. Hash Table
ANSWER: D
Which of the following is NOT a role of a lexer in a compiler?
A. Identifying tokens
B. Performing semantic analysis
C. Ignoring whitespace and comments
D. Generating errors for invalid tokens
ANSWER: B
Which of the following memory sections typically holds the executable code of a program?
A. Stack
B. Heap
C. Data segment
D. Code segment
ANSWER: D
Which component of the compiler interacts with all phases of the compilation process and is
responsible for storing information about identifiers, such as variable names and their types?
A. Lexical Analyzer
B. Parser
C. Symbol Table
D. Code Generator
ANSWER: C
Which principle of compiler design ensures that the generated code runs efficiently on the target
platform?
A. Lexical Analysis
B. Syntax Analysis
C. Semantic Analysis
D. Code Optimization
ANSWER: D
Which protocol is used for secure communication over the internet, providing encryption and
authentication?
A.HTTPS
B.FTPS
C.SSH
D.SSL
ANSWER: D
Which wireless technology is commonly used for local area networking and internet access within
buildings?
A. Bluetooth
B. Cellular
C. Wi-Fi
D.NFC (Near Field Communication)
ANSWER: C
What is the purpose of CIDR (Classless Inter-Domain Routing)?
A. To allocate IP addresses based on classes (A, B, C)
B. To simplify the allocation of IP addresses and routing table entries
C. To encrypt data packets for secure transmission
D. To determine the physical location of an IP address
ANSWER: B
In IPv4, what is the subnet mask used for?
A. To identify the network portion of an IP address
B. To identify the host portion of an IP address
C. To encrypt data packets
D. To determine the physical location of an IP address
ANSWER: A
Which layer of the OSI model ensures that data is transferred reliably between two network hosts,
providing features like flow control, error correction, and sequencing?
A. Physical Layer
B. Transport Layer
C. Network Layer
D. Data Link Layer
ANSWER: A
What is the primary function of the ARP (Address Resolution Protocol)?
A. Translates domain names to IP addresses
B. Determines the MAC address of a device based on its IP address
C. Routes packets between different networks
D. Establishes a secure connection between client and server
ANSWER: B
What network service provides centralized authentication and authorization for users and devices?
A.LDAP
B.DHCP
C.DNS
D.SNMP
ANSWER: A
What is the purpose of a shebang line (#!/bin/bash) in a Bash script?
A. It comments out code
B. It specifies the author of the script
C .It identifies the interpreter to use for executing the script
D. It indicates the version of the script
ANSWER: C
Which file is commonly used to configure zones in BIND?
A .named.conf
B .dns.conf
C. zone.conf
D. bind.conf
ANSWER: A
Which of the following is NOT a common component of a security policy?
A. Data encryption
B. User training
C. Hardware maintenance
D. Incident response procedures
ANSWER: C
What is the purpose of the MX record in DNS?
A. It specifies the mail server responsible for receiving email on behalf of a domain
B. It specifies the web server for a domain
C. It specifies the authoritative name server for a domain
D. It specifies the IP address for a domain
ANSWER: A
What is the primary function of Postfix?
A. Serving DNS queries
B. Managing mail transfer
C. Hosting websites
D. Managing databases
ANSWER: B