>
CPET
List of top Questions asked in CPET
What is the number of page faults for the following memory reference sequence using LRU considering 3 frames per process?
1, 7, 2, 3, 2, 4, 5, 6, 1
CPET - 2025
CPET
Computer Science
Operating Systems - Virtual Memory
What is the maximum number of nodes in a binary tree of height h (where height is measured as the number of edges from the root to the deepest node)?
CPET - 2025
CPET
Computer Science
Binary Tree Height and Node Count
Which is the best data structure to represent a sparse matrix?
CPET - 2025
CPET
Computer Science
Data Structures - Binary Search Tree
Which of the following is the correct way to declare a friend function in a class?
CPET - 2025
CPET
Computer Science
C++ Friend Functions
What will the following C++ program do?
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ofstream file("example.txt", ios::app);
file << "Hello ";
file.close();
return 0;
}
CPET - 2025
CPET
Computer Science
file handling
What is the output of the following C++ code?
# include <iostream.h>
class Base {
public:
void show() {cout << "Base"; }
};
class Derived : public Base {
public:
void show() {cout << "Derived"; }
};
int main() {
Base* b = new Derived();
b->show();
}
CPET - 2025
CPET
Computer Science
C++ Virtual Functions and Static Binding
Which of the following is the correct way to open a binary file for both reading and writing in C++?
CPET - 2025
CPET
Computer Science
C++ File Streams and Open Modes
Given the following C++ code, what will be the order of constructor execution?
class A { public: A() { std::cout << "A" ; } };
class B : public A { public: B() { std::cout << "B" ; } };
class C : public B { public: C() { std::cout << "C" ; } };
int main() { C obj; return 0; }
CPET - 2025
CPET
Computer Science
C++ Constructors and Inheritance Order
What is the main purpose of declaring a base class as virtual in multiple inheritance?
CPET - 2025
CPET
Computer Science
OOP in C++ - Virtual Inheritance
What happens if a derived class defines a function with the same name as a base class function, but with a different parameter list?
CPET - 2025
CPET
Computer Science
C++ Inheritance and Name Hiding
What happens if a class contains at least one pure virtual function?
CPET - 2025
CPET
Computer Science
OOP in C++ - Abstract Classes
Which of the following is a key reason for choosing DRAM over SRAM for main memory?
CPET - 2025
CPET
Computer Science
Computer Organization - Memory Technology
Which of the following components in an FPGA is responsible for implementing combinational and sequential logic?
CPET - 2025
CPET
Computer Science
Digital Design - FPGA Architecture
What is the result of multiplying the two signed 8-bit binary numbers (using 2's complement representation) 01101010 and 11001100?
CPET - 2025
CPET
Computer Science
Computer Arithmetic - 2's Complement Representation
What is the 8-bit 2's complement representation of the decimal number -77?
CPET - 2025
CPET
Computer Science
Computer Arithmetic - 2's Complement Representation
What will happen if you do not call fclose(fp), after opening a file in C?
CPET - 2025
CPET
Computer Science
file handling
An AND Gate has 7 inputs. How many input words are in its truth table?
CPET - 2025
CPET
Computer Science
Digital Logic
According to De Morgan's first theorem a NOR Gate is equivalent to a __________ Gate.
CPET - 2025
CPET
Computer Science
Digital Logic
In a 4-bit synchronous binary counter using JK flip-flops, what will be the state of the counter after 15 clock pulses, if it starts at 0000?
CPET - 2025
CPET
Computer Science
Digital Electronics - Sequential Circuit Hazards
In a synchronous sequential circuit, which of the following conditions may cause a race condition?
CPET - 2025
CPET
Computer Science
Digital Electronics - Sequential Circuit Hazards
What will be the output of the following program?
#include <stdio.h>
int main() {
int i, j;
for (i = 0, j = 5; i < j; i++, j--) {
printf("%d %d |", i, j);
}
return 0;
}
CPET - 2025
CPET
Computer Science
C Language Basics
What will be the output of the following C code?
# include <stdio.h>
int main()
{ int arr[5] = {1, 2, 3, 4, 5};
int *ptr = arr;
*(ptr + 2) = *(ptr + 4) + *(ptr + 1);
printf("%d\n", arr[2]);
return 0; }
CPET - 2025
CPET
Computer Science
Pointers and Arrays
What is the output of the following C code?
#include <stdio.h>
void func(int arr[]) {
sizeof(arr) == sizeof(int) * 5 ? printf("True\n") : printf("False\n");
}
int main() {
int arr[5] = {0};
func(arr);
return 0;
}
CPET - 2025
CPET
Computer Science
Pointers and Arrays
What will be the output of the following program?
#include <stdio.h>
void test() {
static int x;
printf("%d", x);
x++;
}
int main() {
test();
test();
test();
return 0;
}
CPET - 2025
CPET
Computer Science
C Language Basics
The pointer that points to a memory location that has been already deallocated is known as:
CPET - 2025
CPET
Computer Science
Pointers and Arrays
Prev
1
...
14
15
16
Next