Programming Languages Fundamentals: Python, C, and C++

Test your knowledge of fundamental concepts in Python, C, and C++ programming languages including data types, structures, pointers, functions, templates, and object-oriented programming features.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following are storage qualifiers in C++ ?

  1. const
  2. volatile
  3. mutable
  4. All the Above
  5. None of the Above
Question 2 Multiple Choice (Single Answer)

Which of the following exists in C++?

  1. virtual destructor
  2. virtual constructor
  3. Both A and B
  4. None of the Above
Question 3 Multiple Choice (Single Answer)

A template can be instantiated by

  1. Explicit Instantiation
  2. Implicit instantiation
  3. Both A and B
  4. None of the Above
Question 4 Multiple Choice (Single Answer)

The member functions of a class can be defined outside the Class using

  1. Extraction Operator
  2. Insertion Operator
  3. Scope resolution operator
  4. None of the Above
Question 5 Multiple Choice (Single Answer)

The other name for external variables in C++ is

  1. static variables
  2. register variables
  3. global variables
  4. None of the Above
Question 6 Multiple Choice (Single Answer)

Class that reads and writes to an array in memory is

  1. ostream
  2. ifstream
  3. strstream
  4. None of the Above
Question 7 True/False

Can a copy constructor accept an object of the same class as parameter, instead of reference of the object?

  1. True
  2. False
Question 8 Multiple Choice (Single Answer)

What happens when the following program is validated? void main() { void ptr = (void) malloc(sizeof(void)); ptr++ ; }

  1. CompilationFails
  2. Will Throw RunTime Error But Code will get Compiled
  3. Throws Linker Error
  4. All the above statements are invalid
Question 9 True/False

Is the following statement valid. double price = 7,450.98;

  1. True
  2. False
Question 10 True/False

We need to have a structure day of type date which has the following values. Date day = {17,2,2011}; Will the following Structure declaration Correct? struct date { int mm ; int dd ; date year ; }day;

  1. True
  2. False
Question 11 Multiple Choice (Single Answer)

Using pointers to call a function is called as

  1. call by value
  2. call by reference
  3. call by address
  4. All the Above
Question 12 Multiple Choice (Single Answer)

What will be the output of the following code? #include<stdio.h> #include<conio.h> void main() {     char c=-'a';     printf("%d",c); }

  1. 65
  2. -65
  3. 97
  4. -97
  5. CompilationError
Question 13 Multiple Choice (Single Answer)

The insertion of the code of a called function at the point where The function gets called is achieved by

  1. Inline functions
  2. virtual functions
  3. Both A and B
  4. None of the Above
Question 14 Multiple Choice (Single Answer)

What will be the output of the following code segment? #include<stdio.h> #include<conio.h> void main() {     int a[]={0,1,2,3,4,5,6,7,8,9,10};     int i=0,num;     num=a[++i+a[++i]]+a[++i];     printf("%d",num); }

  1. 6
  2. 7
  3. 8
  4. 9
  5. CompilationError
Question 15 Multiple Choice (Single Answer)

What will be the output of following code segment? #include<stdio.h> #include<conio.h> void main() {     char c=-'a';     printf("%d",c); }

  1. 65
  2. -65
  3. 97
  4. -97
  5. CompilationError
Question 16 Multiple Choice (Single Answer)

What will be the output of following code segment? #include<stdio.h> int main() {     int num,a=5;     num=-a--;     printf("%d  %d",num,a); }

  1. 5,4
  2. -4,4
  3. -5,4
  4. -4,5
  5. Compilation Error
Question 17 True/False

Is python a loosely typed language.?

  1. True
  2. False
Question 18 True/False

Is python an object oriented language.?

  1. True
  2. False
Question 19 Multiple Choice (Single Answer)

Which of the following is an invalid data type in python ?

  1. string
  2. complex
  3. double
  4. float
Question 20 Multiple Choice (Single Answer)

How many number of structures are there in python ?

  1. 2
  2. 3
  3. 4
  4. 5