Practice C Programming Questions and Answers
- In C++, which operator is used to access a member function through a pointer to an object?
- In C, which function is used to release dynamically allocated memory?
- Which of the following is true about Java interfaces?
- In Python, which method is used to convert a string to lowercase?
- Which of the following is a valid C++ constructor?
- In C, which keyword is used to define a constant value?
- In Java, which method is called when an object is garbage collected?
- Which Python statement is used to create an empty set?
- In C++, which access specifier allows members to be accessible only within the class?
- Consider a table Orders with columns OrderID, CustomerID, OrderDate, and TotalAmount. Which SQL query would correctly find the total number of orders and t...
- What will be the output of the following C code snippet? int a = 10; int *p = &a; *p = 20; printf("%d", a);
- Which storage class specifier in C allows a local variable to retain its value between successive function calls, while keeping its scope limited to the fu...
- What is the output of the following C code? #include int main() { Β Β int i; Β Β for (i = 0; i < 3; i++) { Β Β Β Β printf("%d ", i); Β Β } Β Β ...
- What is the output of the following C++ code? #includeΒ Β Β using namespace std; int main() { Β Β int x = 5; Β Β int &ref = x; Β Β ref = 10; Β Β ...
- Which C++ inheritance access specifier, when used to inherit a base class, causes all public and protected members of the base class to become private memb...
- What is the output of the following C code? int arr[5] = {10, 20, 30, 40, 50}; int *p = arr; printf("%d", *(p+2) + *(arr+3) - *(p+1));
- In C++, a base class pointer holds the address of a derived class object. The base class declares a non-virtual member function that the derived class rede...
- What is the output of the following C code? int x = 5, y = 2; printf("%d", x++ / y + x % y);
- What is a key difference between the malloc() and calloc() functions in C?
- Consider the following C structure on a typical 32-bit system, where int is 4 bytes, char is 1 byte, and the compiler applies default structure padding for...
- Consider the following C code: Β int a[]={10,20,30,40};Β int *p=a;Β What is the value of *(p+2)?
- Why should a C++ base class destructor be virtual when deleting derived objects through base pointers?
- What is printed if we execute the following C code? int a=5;Β int *p=&a;Β (*p)++; Β printf("%d",a);Β
- In C,Β int x=10;Β printf("%d %d",x++,++x);Β What is the most accurate statement?
- What is the output of the following C code? int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; printf("%d", *(*(arr+2)+1));
- What is the output of the following C code? int a = 12, b = 10; printf("%d", a & b | a ^ b);
- What is the output of the following Java code? try { Β Β int[] arr = new int[3]; Β Β System.out.println(arr[5]); } catch (NullPointerException e) { Β ...
- What is the output of the following C code? int arr[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; printf("%d", *(*(arr+1)+2));
- What is the output of the following C code? void func(int n) { Β Β if (n == 0) return; Β Β printf("%d ", n); Β Β func(n-1); Β Β printf("%d ", n); }...
- What is the output of the following C++ program? ...
- Given the C structure 'struct Node { int data; struct Node *next; };' on a 64-bit system where int is 4 bytes and a pointer is 8 bytes, and assuming no pad...
- What is the output of the following recursive C function call? ...
- What is the output of the following C++ program using virtual functions? ...
- What will be printed by the following C code ? int x = 13, y = 6; printf("%d", (x & y) + (x | y) - (x ^ y));
- What is the output of the following C code? int x = 5; int y = x++ + ++x; printf("%d %d", x, y);
- In Object-Oriented Programming, which mechanism allows a subclass to provide its own specific implementation of a method that is already defined in its sup...
- Consider the C structure: struct A { char c; int i; }; On a typical system where int requires 4-byte alignment, what is the most likely total size of struc...
- In C, when an array is passed as a parameter to a function, what does sizeof(arr) typically return when evaluated inside that function?
- Which C++ keyword, when applied to a base class member function, enables runtime polymorphism by allowing that function to be overridden and correctly disp...
- What will be the output of the following C code: int a = 10, b = 3; printf("%d", a / b);
More Topics
- Algorithms Questions
- Analog and Digital Communication Questions
- Artificial Intelligence & Machine Language Questions
- Basics of Computers Questions
- Big Data Analytics Questions
- C++ Questions
- Cloud Computing Questions
- Compiler Design Questions
- Computer Architecture and Design Questions
- Cyber Security Questions
- Data Analytics Languages Questions
- Data Structure Questions
- Data Warehousing Questions
- Digital Logic Questions
- Emerging Technologies Questions
- IOT and mobile Computing Questions
- IT DBMS Questions
- IT Networking Questions
- IT Operating System Questions
- Java Language Questions
- Machine Learning Questions
- Memory Management Questions
- Microsoft Office Questions
- Miscellaneous Questions Questions
- Network Layer and IP Protocol Questions
- Numerical and Statistical Computing Questions
- Object Oriented Programming Questions
- OOPS Concepts Questions
- Previous Year Questions Questions
- Programming Concept Questions
- Python Questions
- Shell Scripting Questions
- Software Engineering and Web Technology Questions
- SQL Questions
- String Manipulation Questions
- TCP IP and OSI Questions