My Report

C++ Programming Practice Test 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What happens if the following program is compiled in both C and C++?

#include<stdio.h>
struct STRUCT
{
  int static a;
};
int main()
{
  struct STRUCT s;
  return 0;
}

2. Which of the following escape sequence represents carriage return?

3. Which of the following is correct?

4. Which of the following escape sequence represents tab?

5. Which of the following syntax can be used to use a member of a namespace without including that namespace?

6. What will be the output of the following C++ code?

    #include <iostream>
    using namespace std;
    int f(int p, int q)
    {
        if (p > q)
            return p;
        else
            return q;
    }
    main()
    {
        int a = 5, b = 10;
        int k;
        bool x = true;
        bool y = f(a, b);
        k =((a * b) + (x + y));
        cout << k;
    }

7. How many types of polymorphism are there?

8. Which of the following is a valid floating-point literal?

9. Which of the following supports the concept that reusability is a desirable feature of a language?

10. Wrapping data and its related functionality into a single entity is known as _____________


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.