Computer Knowledge

Programming Fundamentals

2,381 Questions

Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.

Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references

Programming Fundamentals Questions

Multiple choice
  1. This function is used to convert the integer into float type.

  2. This method is used to convert the string of digits into the corresponding integer.

  3. This method is used to convert a string into an integer.

  4. This method is used to convert the characters into string format.

  5. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is true about ''atoi' function in C language.

Multiple choice
  1. A null pointer is a special pointer that does not point anywhere.

  2. We can declare the null pointer as int *a=NULL.

  3. We can declare the null pointer as int *a=0.

  4. NULL is also known as pre-processor macro.

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Yes, all are the true statements.

Multiple choice
  1. A function pointer is a function that is used to store the address of the function.

  2. Function pointers can be used to set callback functions.

  3. Virtual functions are implemented by the function pointers.

  4. All of the above are true.

  5. Only (1) and (3) are true.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Yes, all are the true statements.

Multiple choice
  1. It ensures that the access to a class is denied.

  2. It ensures that there is an attempt to create an object of an abstract class or interface.

  3. It ensures that one thread has been interrupted by another thread.

  4. It ensures that the particular class is not found.

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

This is the correct choice. NoSuchFieldException ensures that the requested field does not exist.

Multiple choice
  1. 50

  2. 15

  3. 100

  4. 65

  5. None of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

  Key concepts: this is used to access methods or variables of the current class. super is used to access methods or variables of the base class. Program execution after creating object for child class C , is given as follows ||| |---|---| |class A {   int a,b;   A()   {      a=20;      b=30;   } }|a=20, b=30| |class B {   int a=10,b=5;   B()   {      a=this.a+super.a;      b=this.b+super.b;   } }|a=10+20=30, b=5+30=35  | |class C {   C()   {      System.out.println(super.a+super.b);   } }|prints a+b value a+b=30+35=65| | |Hence 65 is the output of the given program|

Multiple choice
  1. C++ supports null pointers.

  2. int *ptr[abs] is the example of array of pointer to an integer.

  3. In C++, we can pass pointer to a function.

  4. All of the above.

  5. Only (1) and (3) are true.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Yes, all of the above three are the true statements.