T TestsWorld

Free practice test · Computer Science

Exam C++

39 questions with a timer and instant results. Practise in short drills or take the full test, then see exactly which topics need work.

📝 39 questions ⏱ 20 min for all 🎯 Pass mark 75% 💸 Free, unlimited attempts
⚡
Short drills

Pick 10, 25 or 50 questions for a quick round, or take all of them.

💡
Learn as you go

Practice mode shows the right answer and an explanation for every question.

📊
See your weak spots

Your result shows strong and weak topics and what to read next.

What's in the test

Easy 46% Medium 46% Hard 8%
Virtual Base Classes 1Operator Precedence 1File Pointers 1Linux Commands 1DB-Library Functions 2C Versus C++ 1Main Function 1File Streams 3Logical Operators 1Preprocessor Directives 1Dynamic Memory 1Const Parameters 1

Sample questions with answers

6 of the 39 questions in Exam C++. Try each one, then open the answer.

  1. Question 1
    How do you declare Virtual Base classes?
    • A. Derived: virtual public Base
    • B. class Base: virtual public Derived
    • C. class Derived: public Base virtual
    • D. class Base: public Derived virtual
    Show answer
    Answer: A. Derived: virtual public Base
    Virtual Base Class is defined by class Base: virtual public Derived
  2. Question 2
    What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)?
    • A. 6
    • B. 8
    • C. An unlimited number
    Show answer
    Answer: A. 6
    6 number of digits can be accuratly stored in a float (based on the IEEE Standard 754)?
  3. Question 3
    What does the statement fp.seekg(16) do? (Assume that the file has been opened using fp which is an object of the fstream class)
    • A. Positions the file pointer 16 bytes from the end of the file.
    • B. Positions the file pointer 16 bytes from the beginning of the file.
    • C. Positions the file pointer 16 bytes from the current location of the file ptr.
    • D. Positions the file pointer at the end of the file.
    Show answer
    Answer: B. Positions the file pointer 16 bytes from the beginning of the file.
    Positions the file pointer 16 bytes from the beginning of the file. Is the correct answer It shows tht the bytes where begin with the position 16 byte.
  4. Question 4
    Which of the following is evaluated first:
    • A. &&
    • B. ||
    • C. !
    Show answer
    Answer: C. !
    ! Is evaluated first
  5. Question 5
    You have logged into the console as user1. Now you log in as root using the su command. Which user identities do the whoami and who am i commands report?
    • A. whoami reports root, who am i reports root.
    • B. whoami reports user1, who am i reports root.
    • C. whoami reports root, who am i reports user1.
    • D. whoami reports user1, who am i reports user1.
    Show answer
    Answer: C. whoami reports root, who am i reports user1.
    The answer of this question is whoami reports root, who am i reports root.Because When you log into a console and when you change it into the another then it shows the root directory. So option 1 is the correct answer.
  6. Question 6
    What does 7/9*9 equal (in C and C++)?
    • A. 1
    • B. 0.08642
    • C. 0
    • D. 7
    Show answer
    Answer: C. 0
    when 7/9 the value we get is 0.77777777777777778 and when it multiply with 9 the output becomes 7. So 7 is the correct answer.

Want all 39 with a timer and a topic-wise result? Start the free test at the top of this page.

About this practice test

This test is a Series of Tests containing a collection of C++

All the questions in this test are REAL C++ Questions.

At the end of the test, you will receive an exhaustive review of all the questions to clarify all your doubts.

Most EXHAUSTIVE collection of certification questions !

This practice test is part of TestsWorld's Computer fundamentals track — MCQs covering computer science basics, operating systems, programming fundamentals and applications. The bank is widely used by school and college students preparing for entrance tests, government recruitment exams and campus-placement aptitude tests.

What this practice test gives you

40 multiple-choice questions covering the subject area, served from a randomised order so each attempt feels fresh. Take the test at your own pace. Allowed time per attempt: 20 min. Pass mark: 75%.

Study tips. Read every explanation, including on questions you answered correctly — they often surface adjacent concepts you may face on the live exam. After a full attempt, review your incorrect and skipped questions in detail before re-attempting. Combined with official study material, this practice bank is most effective when you cycle through it multiple times over a few weeks of preparation.

More tests in Computer Science

Before you start: device, fullscreen and proctoring