Question 1 of 25
Hints left: 3
Q1
What is the result of the following expression in C++: 5 / 2?
Q2
What happens if the following code is compiled on both C and C++? #include<stdio.h> struct STRUCT { private: int a; }; int main() { printf("%d\n", (int)sizeof(struct STRUCT)); return 0; }
Q3
What is the correct keyword to declare a variable in C++?
Q4
What happens if we run the following code in both C and C++? #include<stdio.h> struct STRUCT { int a; int func() { printf("HELLO THIS IS STRUCTURE\n"); } }; int main() { struct STRUCT s; s.func(); return 0; }
Q5
Which of the following is correct?
Q6
What is the size of a 'char' data type in C++?
Q7
What will be the output of the following code: cout << (true && false); in C++?
Q8
What is the maximum value that can be stored in an 'int' data type in C++?
Q9
What is the data type of the variable 'x' in the following declaration: double x = 3.14;?
Q10
What will be the output of the following C++ code? #include <stdio.h> int main() { const int x; x = 10; printf("%d", x); return 0; }
Q11
Which of the following C++ code will give error on compilation? ================code 1================= #include <iostream> using namespace std; int main(int argc, char const *argv[]) { cout<<"Hello World"; return 0; } ======================================== ================code 2================= #include <iostream> int main(int argc, char const *argv[]) { std::cout<<"Hello World"; return 0; } ========================================
Q12
Which operator is overloaded for a cout object?
Q13
Which members are inherited but are not accessible in any case?
Q14
What is the range of values for a 'short int' data type in C++?
Q15
What happens if the following line is executed in C and C++? int *p = malloc(10);
Q16
Which operator is used to find the size of a data type in C++?
Q17
What is the correct way to declare a constant in C++?
Q18
Which of the following statement is true? I. In Procedural programming languages, all function calls are resolved at compile-time II. In Object Oriented programming languages, all function calls are resolved at compile-time
Q19
Which of the following is correct about dynamic polymorphism?
Q20
Which of the following is a valid variable name in C++?
Q21
Which of the following is C++ equivalent for printf()?
Q22
In which part of the for loop termination condition is checked? for(I;II;III) {IV}
Q23
What is the correct syntax to declare and initialize a variable 'age' of type 'int' with a value of 25 in C++?
Q24
What happens if the following program is executed in C and C++? #include <stdio.h> int main(void) { const int j = 20; int *ptr = &j; printf("*ptr: %d\n", *ptr); return 0; }
Q25
Which of the following is not a primitive data type in C++?