Latest Qualification Jobs

Computer Programming Questions – 50+ Best Programming MCQ/Interview Ques

Computer Programming Questions

50+ Best Computer Programming Questions in the form of MCQ as well as questions asked in interview round is given here. Computer Programming Questions and Answers will helps you in testing your knowledge related to different programming languages. So, practice from these given Computer Programming MCQ and evaluate your performance.

recruitmentresult.com

Computer Programming Questions for Interview round are also available here. Candidates going to appear for any entrance/competitive exam that includes written or interview round, can go through these selected questions and do preparation for their examination.

Computer Programming Questions

Computer Programming MCQ with Answers

Answers for these questions are available at the end.

Question 1) Trace the output.

void main()
{
int i=2,j=2;
while(i+1?–i:j++)
printf(“%d”,i);
}

a. 1
b. 2
c. ERROR
d. None of the above.

Question 2) Match the following:

(a) calloc( )  ——- i. Frees previouslyallocated space.
(b) free( ) ———– ii. Modifiespreviouslyallocated space.
(c) malloc( ) ——- iii. Allocates spacefor array.
(d) realloc( ) ——- iv. Allocatesrequested size ofspace.

a. a-iii, b-i, c –iv, d -ii
b. a-iii, b-ii, c –i, d -iv
c. a-iii, b-iv, c –i, d -ii
d. a-iv, b-ii, c –iii, d -i

Question 3) Trace the output

int main()
{
int a=12,b=39;
printf (“%d”,a&b);
return 0;
}

a. 468
b. 0
c. 4
d. None of the above.

Get Here Objective Type: Microsoft Windows Questions and Answers

Question 4) If you want to store dissimilar data together, then which type you will use?

a. array
b. structure
c. stack
d. None of the above.

Question 5) State true of false.

It is possible to pass a structure variable to a function either by value or by address.

a. True
b. False

Question 6) Suppose that x is a one dimensional array, then choose the correct answer regarding array.

a. *(x + n) is same as &x[n]
b. *&x[n] is same as x + n
c. *(x + n) is same as x[n] +1
d. *(x + n) is same as *x[n]

Question 7) A collection of generic class and function is called as

a. Standard Template Library (STL)
b. Header file
c. Function template.
d. None of the above.

Question 8) Which of the following is\are true about virtual function?

a. Function call is resolved at run-time
b. It is member function of a class.
c. Generally has a different functionality in the derived class.
d. All of the above.

Question 9) The Standard Template Library (STL) consists of three main components. What are those components?

a. ADT, Structure,class.
b. Containers, Algorithms, and statements.
c. Containers, Algorithms, and Iterators.
d. None of the above.

Question 10) What is RTTI?

a. Run-Time Type Identification (RTTI) is a technique that is used to know the type of any object at run time.
b. RTTI is a technique that is used to know the type of any object at compile time.
c. RTTI reserve memory of function at run time.
d. None of the above.

Get Here: Computer Memory Questions and Answers

Question 11) Which of the following is\are correct statements about inline function and macros.

a. Inline functions are parsed by the compiler but Macros are expanded by the C++ preprocessor.
b. Inline functions follow strict parameter type checking.
c. Macros do not follow parameter type checking.
d. All of the above.

Question 12) Which is true about a method-local inner class?

a. It must be marked final.
b. It can be marked abstract.
c. It can be marked public.
d. It can be marked static.

Question 13) Which constructs an anonymous inner class instance?

a. Runnable r = new Runnable() { };
b. Runnable r = new Runnable(public void run() { });
c. Runnable r = new Runnable { public void run(){}};
d. System.out.println(new Runnable() {public void run() { }})

Question 14) Which of the following allows the programmer to destroy an object x?

a. x.delete()
b. x.finalize()
c. Runtime.getRuntime().gc()
d. Only the garbage collection system can destroy an object.

Check Out: Computer Graphics Questions

Question 15) Which of the following statements are correct?

a. If multiple listeners are added to a component only events for the last listener added will be processed
b. If multiple listeners are added to a component the events will be processed for all but with no guarantee in the order
c. Adding multiple listeners to a component will cause a compile time error
d. You cannot remove or add listeners to a component.

Question 16) What can cause a thread to stop executing?

a. The program exits via a call to System.exit(0);
b. Another thread is given a higher priority
c. A call to the thread’s stop method
d. All of the above

Question 17) Which of the following methods are members of the Vector class and allow you to input a new element?

a. addElement
b. insert
c. append
d. addItem

Question 18) In C programming a function can return ___________

a. Single value
b. Double value
c. Many value
d. all of the above

Question 19) Array index always start from

a. 0
b. 1
c. 2
d. 3

Question 20) The function that calls itself for its processing is known as.

a. Inline Function
b. Nested Function
c. Overloaded Function
d. Recursive Function

Get Here: 44+ Data Communication Questions

Question 21) Which of the following cannot be checked in a switch-case statement?

a. Character
b. Integer
c. Float
d. enum

Question 22) What is the default return-type of getchar()?

a. char
b. int
c. char *
d. Reading character doesn’t require a return-type

Question 23) Identify the wrong syntax

a. typedef struct { member declaration; } NAME; NAME V1, V2;
b. typedef struct tag{ member declaration; } NAME; NAME V1, V2;
c. typedef struct { member declaration; } NAME; NAME V1, V2;
d. typedef struct tag { member declaration; } NAME; NAME V1, V2;

Question 24) Which of the following does not represent a valid storage class in C?

a. static
b. union
c. extern
d. automatic

Question 25) Trace the output.

int main()
{
int i = 5;
int *j;
int **k;
j=&i;
k=&j;
printf(“%u %u %d “,k,*k,**k);
return 0;
}

a. some address, some address, 5
b. some address, 5, 5
c. 5 , 5 , 5
d. None of the above.

Read Out: 55+ MS Excel Questions and Answers

Question 26) Trace the output

void main()
{
register R=20;
int * P=&R;
printf(“%d”, *P);
}

a. some address.
b. 20
c. Compile time error.
d. None of the above.

Question 27) A pointer in c which has not been initialized is known as

a. far pointer
b. void pointer
c. null pointer
d. wild pointer

Question 28) Trace the output.

extern int P
void main()
{
printf(“%d”, P);
}

a. Error
b. 0
c. P
d. None of the above

Question 29) There is two types of polymorphism, Compile time and Runtime polymorphism. Runtime polymorphism can be achieved through.

a. function overloading
b. virtual function
c. operator overloading
d. None of the above.

Question 30) In C++, dynamic memory allocation is achieved with the operator

a. new
b. this
c. malloc( )
d. calloc()

Get Here: Basic Internet Questions and Answers

Question 31) How many arguments are in copy constructor?

a. No argument
b. Any number of arguments.
c. One argument
d. None of the above.

Question 32) Trace the output.

class base
{
private: int x;
protected: int y;
public:
base()
{
x=10;
y=20;
}
};
class derived : public base
{
protected:
int a, b;
void change( )
{
a=x;
b=y;
cout << a << b;
}
};
void main()
{
derived  obj;
obj.change();
}

a. 10 20
b. Run time error.
c. Compile time error.
d. None of the above

Question 33) Trace the output.

void main()
{
float x=5,y=2;
int result;
result=x % y;
cout << result;
}

a. 1
b. 2.5
c. 1.0
d. Error

Question 34) What will be the result of the expression 13 & 25?

a. 12
b. 25
c. 9
d. 0

Question 35) Which technique is used to temporarily removing non-active programs from the memory of computer system?

a. Swapping
b. Spooling
c. Scheduler
d. None of the above.

Check Out: MS PowerPoint Questions

Question 36) Catch handler can have multiple parameters.

a. True
b. False

Question 37) It is not possible to combine two or more file opening mode in open () method.

a. True
b. False

Question 38) Overloading the function operator

a. Requires a class with an overloaded operator.
b. Requires a class with an overloaded [ ] operator.
c. Allows you to create objects that act syntactically like functions.
d. Usually make use of a constructor that takes arguments.

Question 39) Scope resolution operator is used______

a. To resolve the scope of global variables only
b. To resolve the scope of functions of the classes only
c. To resolve scope of global variables as well as functions of the classes
d. None of these

Start Here: MS Excel Quiz

Question 40) The purpose of explicit keyword is to tell the compiler that a certain constructor may not be used to implicitly cast an expression to its class type.

a. True
b. False

Answers:

Ans1) aAns15) bAns29) b
Ans2) aAns16) dAns30) a
Ans3) cAns17) aAns31) c
Ans4) bAns18) aAns32) c
Ans5) aAns19) aAns33) d
Ans6) aAns20) dAns34) c
Ans7) aAns21) cAns35) a
Ans8) dAns22) bAns36) b
Ans9) cAns23) dAns37) b
Ans10) aAns24) bAns38) a
Ans11) dAns25) aAns39) c
Ans12) bAns26) cAns40) a
Ans13) dAns27) d 
Ans14) dAns28) a 

Computer Programming Interview Questions and Answers

Question 1) What is debugging?

Answer 1) Debugging is the process of finding and removing errors in a program. In this process, the program is thoroughly checked for errors. Then errors are pointed out and debugged.

Question 2) When a logical error occurs?

Answer 2) The logical error happens when a program implements the wrong logic. The translator (compiler or interpreter) does not report any error message for a logical error. These errors are the most difficult to locate.

Question 3) What is an algorithm?

Answer 3) An algorithm is a finite set of steps which, if followed, accomplish a particular task. An algorithm must be clear, finite and effective.

Question 4) What are variables?

Answer 4) Variables are named memory locations (memory cells) which are used to store the program’s input and its computational results during program execution. As the name suggests, the value of a variable may change during the program execution.

Question 5) What is Computer programming?

Answer 5) Computer Programming is also known as programming or coding. Programming is a process which includes processes such as coding, maintaining, updating, debugging, writing, designing (algorithm), etc.

Read Out: Computer Networking Interview Questions

Question 6) Name different types of errors which can occur during the execution of a program?

Answer 6) There are three types of errors which can occur during the execution of a program.

  • Syntax Errors
  • Runtime Errors
  • Logical errors

Question 7) How does programming work?

Answer 7) Programming contains a set of instructions for the computer to perform different tasks. In fact, those instructions are executable commands, each having a different purpose.

Question 8) When a syntax error occurs?

Answer 8) A syntax error occurs when the program violates one or more grammatical rules of the programming language. These errors are detected at compile time, i.e., when the translator (compiler or interpreter) attempts to translate the program.

Question 9) What is a flowchart?

Answer 9) The flowchart is a pictorial representation of a program which helps in understanding the flow of control and data in the algorithm.

Question 10) What do you understand by the term “Maintain and update the Program”?

Answer 10) Program maintenance is an ongoing process of upgrading the program to accommodate new hardware or software requirements and introducing minor or great improvements. Essentially, it is the expansion, updating and improvement of a program after its installation.

Read Out: Computer Hardware Questions with Answers

Question 11) When a runtime error occurs?

Answer 11) A runtime error occurs when the computer is directed to perform an illegal operation by the program such as dividing a number by zero. Runtime errors are the only errors which are displayed immediately during the execution of a program. When these errors occur, the computer stops the execution of the programming and can display a diagnostic message that will help in locating the error.

Question 12) What are reserved words?

Answer 12) Reserved words or keywords are the words, which have predefined meanings. They have predefined uses and cannot be used or redefined for any other purpose in a programming language.

Examples: IF, ELSE, THEN

Question 13) What are loops?

Answer 13) The loop is a structure which can repeat a set of statements up to a fixed number of times or until a certain criterion is satisfied.

Question 14) Name different types of loops.

Answer 14) Different types of loops are

  • FOR…NEXT Loop
  • WHILE…WEND Loop
  • Nested Loop

Question 15) What is the use of Nested Loop?

Answer 15) Loop within a loop is called nested loop.

Check Here: Computer Science Questions and Answers

Question 16) What do we call the binary form of a target language?

Answer 16) The binary form of a target language is also called “Binary Code”.

Question 17) Name two types of constants.

Answer 17) Two types of constants are mentioned below:

  • Numeric Constants
  • String Constants

Question 18) What is an Array?

Answer 18) An array is a collection of contiguous memory locations which can store data of the same type.

Question 19) What is the purpose of relational operators?

Answer 19) Relational operators are used to compare two values. These operators always evaluate to true or false. They always produce a non-zero value (in most case 1).

Take Test: Computer Knowledge Quiz

Question 20) What is Machine code?

Answer 20) Machine code is a language, which can be processed directly by a microprocessor without any need of the previous transformation. Programmers never write programs directly in machine code.

Important Computer Programming Questions are well described on this page of recruitmentresult.com, so before appearing for the actual examination must practice these questions and score good marks in the examination. Candidates can stay in touch with us by bookmarking our web portal and get latest updates.

Something That You Should Put an Eye On

How to be a Computer Teacher after GraduationComputer Hardware Quiz
Online Quiz for Competitive ExamsBest Computer Courses For Bright Career
Computer Hardware Engineer SalaryMaths Formulas List 
How To Reduce Negative MarkingReasoning Quiz


Filed in: Question & Answers

Leave a Reply

Submit Comment