Online Examination System for all learner!!! coming soon..

C Programming Online Test 1

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q.1 - What is the output of the following program?

#include
main()
{
register int x = 5;
int *p;
p=&x;
x++;
printf("%d",*p);
}
A - Compile error
B - 5
C - 6
D - Garbage value




Q.2 - What is the output of the following program?

#include
main()
{
int i = 1;
while(i++<=5);
printf("%d ",i++);
}
A - 4
B - 6
C - 2 6
D - 2 4




Q.3 - Special symbol permitted with in the identifier name.

A - $
B - @
C - _
D - .




Q.4 - What is the output of the following program?

#include
main()
{
char *p = NULL;
printf("%c", *p);
}
A - NULL
B - 0
C - Compile Error
D - Runtime error.




Q.5 - What is the output of the following program?

#include
main()
{
#undef NULL
char *s = "Hello";
while(*s != NULL)
{
printf("%c", *s++);
}
}
A - HELLO
B - Compile error: there is no macro called “undef”
C - Compile error: improper place of #undef
D - Compile error: NULL is undeclared.



Q.6 - In C, what are the various types of real data type (floating point data type)?

A - Float, long double
B - long double, short int
C - float, double, long double
D - short int, double, long int, float




Q.7 - Which of the following is a logical OR operator?

A - &
B - &&
C - ||
D - None of the above




Q.8 - Which of the following variable cannot be used by switch-case statement?

A - char
B - int
C - float
D - double




Q.9 - The correct order of evaluation for the expression “z = x + y * z / 4 % 2 – 1”

A - * / % = + -
B - / * % - + =
C - - + = * % /
D - * / % + - =




Q.10 - Choose the function that is most appropriate for reading in a multi-word string?

A - strnset()
B - scanf()
C - strchr()
D - gets()



Tag: c, c programming test questions and answers, c programming exam questions and answers pdf, c online quiz, online c programming practice, c programming online test tutorialspoint, embedded c online test, online c programming test with certificate, c test, c programming online test with answers, c programming test questions and answers, c programming exam questions and answers pdf, c online quiz, online c programming practice, psychometric testing program in c, c test for eye, c aptitude questions and answers with explanation.

JAVA : Program to find sum of all integer greater than 100 and less than 200, that are divisible by 5

 Code:

class findsum
//for more program please visit www.programtubenotes.blogspot.in
{
    public static void main(String args[])
    {
        int a,sum=0;
        for(a=100;a<=200;a++)
        {
            if(a%5==0)
                sum=sum+a;
        }
        System.out.println("Sum="+sum);
    }
}

Output: 

Sum=3150

Java : Write a short note on Multilevel hierarchy.

In our previous tutorial we have discussed all about Inheritance. What is it? Why it is required? and its different types! Moreover, we have already come across Simple Inheritance, here we will discuss Multilevel Inheritance. It is nothing but the enhancement of the Simple Inheritance. From the type name it is pretty much clear that Inheritance is done at ‘n’ number of levels, where n>1.
In simple inheritance a subclass or derived class derives the properties from its parent class, but in multilevel inheritance a subclass is derived from a derived class. One class inherits only single class. Therefore, in multilevel inheritance, every time ladder increases by one. The lower most class will have the properties of all the super classes’.
So it will be like this:
  Person
      ↓
Employee
      ↓
Manager
N.B: Multilevel inheritance is not multiple inheritance where one class can inherit more than one class at a time. Java does not support multiple inheritance.
We will understand Multilevel Inheritance using the following example:
Code:
class Person{
  String personName;
  String address;
  Person(String personName,String address){
    this.personName = personName;
    this.address = address;
  }
  void showPersonalDetails(){
    System.out.println("Name is: "+personName);
  }
}

class Employee extends Person{
  String employeeID;
  double salary;
  Employee(String personName,String address,String employeeID,double salary){
    super(personName,address);
    this.employeeID = employeeID;
    this.salary = salary;
  }
}

class Manager extends Employee{
  int numberOfSubordinates;
    Manager(String personName,String address,String employeeID,double salary,int numberOfSubordinates){
    super(personName,address,employeeID,salary);
    this.numberOfSubordinates = numberOfSubordinates;
  }
}

class MultileveleInheritance{
  public static void main(String args[]){
    Person p =  new Person();
    Employee e = new Employee();
    Manager m = new Manager();
  }
}
Output:

Explanation of Code & Output

Here Person, Employee and Manager are three classes. Manager subclass is derived from Employee subclass which is again derived from Person class. All these classes has one to one relation. So Manager class is the most specialized class among the three which will have the access right to all the members of both Employee and Person. On the other hand, Person super class won’t have access to any of the members of its subclasses, same is true for Employee subclass which won’t have access to the any members of Manager subclass.
All these three classes are written in single java file for your understanding but generally these are put in three different java files.
Next we will checkout how to do method overloading in Java.

VB 6.0: Design a form contains a sorted list alphabetically.

Design a form contains a sorted list alphabetically such that the user can add the item from text to the list after click on command button "add".
Sol:
//for more program please visit www.programtubenotes.blogspot.in 
Private Sub Form_Load()
    List1.List=""

   List1.Sorted=True
   Text1.Text=""
    Command1.Vaption="add"
 End Sub
Private Sub Command1_Click()
list1.AddItem (Text1.Text)
Text1.Text = " "
End Sub


Output:-
after Run the get this window


C Programming Online Test 1

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answ...