Qantler Technologies –  Fresher Interview Questions – Part – II

This blog explains about Qantler Technologies –  Fresher Interview Questions – Part – II . Some of the questions are discussed below . They are :

     We have already discussed about some questions in the previous blog –  Qantler Technologies –  Fresher Interview Questions – Part – I . 

REFERENCES : 

 

https://payilagam.com/blogs/qantler-technologies-fresher-interview-questions-part-i/

_____________________________________________________________________________

  1. Write a program for the following .

if user enters 1,Print sunday.
if user enters 2,Print monday.
.
.
.
if user enters 6,print friday.

SOLUTION :

/**

 * C program to print day name of week

 */

 

#include <stdio.h>

 

int main()

{

    int week;

 

    /* Input week number from user */

    printf(“Enter week number (1-7): “);

    scanf(“%d”, &week);

 

 

    if(week == 1)

    {

        printf(“Monday”);

    }

    else if(week == 2)

    {

        printf(“Tuesday”);

    }

    else if(week == 3)

    {

        printf(“Wednesday”);

    }

    else if(week == 4)

    {

        printf(“Thursday”);

    }

    else if(week == 5)

    {

        printf(“Friday”);

    }

    else if(week == 6)

    {

        printf(“Saturday”);

    }

    else if(week == 7)

    {

        printf(“Sunday”);

    }

    else

    {

        printf(“Invalid Input! Please enter week number between 1-7.”);

    }

 

    return 0;

}

_______________________________________________________________________________

2. Write the program for the following ? 

Get 5 subject marks for a Student.

Write method of type boolean.
This method should process the marks in such a way that mark of any one subject is less than 35,method
should provide false.

Program/Source Code

Here is source code of the Python Program to take in the marks of 5 subjects and display the grade. The program output is also shown below.

sub1=int(input(“Enter marks of the first subject: “))

sub2=int(input(“Enter marks of the second subject: “))

sub3=int(input(“Enter marks of the third subject: “))

sub4=int(input(“Enter marks of the fourth subject: “))

sub5=int(input(“Enter marks of the fifth subject: “))

avg=(sub1+sub2+sub3+sub4+sub4)/5

if(avg>=90):

    print(“Grade: A”)

elif(avg>=80&avg<90):

    print(“Grade: B”)

elif(avg>=70&avg<80):

    print(“Grade: C”)

elif(avg>=60&avg<70):

    print(“Grade: D”)

else:

    print(“Grade: F”)

______________________________________________________________________________

 

3 . Write the program for the following question ? 

Get numbers from user till q is pressed and perform sum of entered numbers .

#main program start

def main():

     #initialize variables

    count = 0

    sum = 0.0    product = 1.0

    data = input(“Enter a number or press Enter to quit: “)

     while True:

        #request input from user

        data = input(“Enter a number or press Enter to quit: “)

         #set up the termination condition

            if data == “”:

            break

         #convert inputs into floats

        number = float(data)

         #calculate sum, product, and average

        sum += number

        product *= number

        average = sum / number

     #display results

    print(“The sum is”, sum)

    print(“The product is”, product)

    print(“The average is”, average)

  #main program endmain()

 

_______________________________________________________________________________

10.Find biggest number among the entered numbers from user.

SOLUTION 

#include<stdio.h>

int main()

{

    int i, n, lar,sm, elem;

    printf (“Enter total number of elements \n”);

    scanf (“%d”, &elem);

    printf (“Enter first number \n”);

    scanf (“%d”, &n);   

lar = n;

    sm=n;

    for (i=1; i<= elem -1 ; i++)

    {

        printf (“\n Enter another number \n”);

        scanf (“%d”,&n);

        if (n>lar)

        lar=n;

        if (n<sm)

        sm=n;

    }

    printf (“\n The largest number is %d”, lar);

    printf (“\n The smallest number is %d”, sm);

    return 0;

}

_______________________________________________________________________________________