C Language Objective 2012 Adv.docx

download C Language Objective 2012 Adv.docx

of 7

Transcript of C Language Objective 2012 Adv.docx

  • 7/29/2019 C Language Objective 2012 Adv.docx

    1/7

    Q#1 Write a function to generate following output and call into main ( ) function

    11 2

    1 2 3

    1 2 3 41 2 3 4 5

    1 2 3 4 5

    1 2 3 41 2 3

    1 2

    1

    Q#2 Write a function to generate following output and call it into main ( ) function using loop.

    ** *

    * * ** * * *

    * * * * *

    1 2 3 4 5

    1 2 3 41 2 3

    1 2

    1*

    ***

    *

    Q#3 Write a function to generate following output and call it into main ( ) function using loop and gotoxy()

    11 2 1

    1 2 3 2 1

    1 2 3 4 3 2 11 2 3 4 5 4 3 2 1

  • 7/29/2019 C Language Objective 2012 Adv.docx

    2/7

    Q#4 Write a function to generate following output and call into main ( ) function

    5

    4 53 4 5

    2 3 4 5

    1 2 3 4 51 2 3 4 5

    1 2 3 4

    1 2 31 2

    1

    Q#5 Write a function to generate the prime number 1 to 50 and call into under main( )

    Q#6 Write a Program to take input character from user and let him know character its vowel or consonant with

    switch statement.

    Q#7 Write a function to generate factorial of the number and number take from user.

    Q#8 Write a program to take input five numbers in array and display it an ascending and Descending Order

    Q#9 Write a program to take input month and date in digit and Display Zodiac Sign using with combination of

    switch and if condition.

    Q#10 Write a function to generate the Fibonacci series from 1 to 50 using while loop and call it into main( )

    Q#11 Write a program to perform matrices subtraction of order 2 x 2 and all values take from user using array

    Q#12 Write a program to perform matrices multiplication of order 2 x 2 and all values take from user using array

    Q#13 Write a function to display ASCII code of the digit from 0 to 9 and call it into main () function

  • 7/29/2019 C Language Objective 2012 Adv.docx

    3/7

    Q#14 Write a program to take input Alphabet in Upper case from user and convert it into Lower case

    A 65+32=97a

    Q#15 Write a program to take input Alphabet in lower case from user and convert it into upper case

    Q#16 Write a program to take input sentence from user and count the character and word in given sentence.

    Q#17 Write a program to take input sentence from user and count the vowel in given sentence using Logical

    Operator.

    Q#18 Write a program that print out the larger of two numbers gentered from the keyboard use a function to do the

    actual comparison of the two numbers. Pass the two numbers to the function as arguments, and have the functionreturn the answer with return.

    Q#19 Write a program to take input string and replace the every appearance of small A into small O for Example

    Karachi into Korochi .

    Q#20 Read a positive integer value, and compute the following sequence if the number is even ,halve it, if its od

    multiply by 3 and add 1.repeat this process until the value is 1,printing out each value finally print out how many othese operation you performed .

    Typical out put might be:

    Initial value is 5Next value is 16

    Next value is 8

    Next value is 4Next value is 2

    Final value 1, Number of step is 5

    If the out put value is less than 1, print the message contains the word

    Error

    Q21-we take two integers, add them and display the answer on the screen.

    Q22-calculates the average age of a class of ten students after prompting the user to enter the age of each student.

    Q23-Write a program that takes a four digits integer from user and shows the digits on the screen separately i.e. if

    user

    Enters 7531, it displays 1,3,5,7 separately.

  • 7/29/2019 C Language Objective 2012 Adv.docx

    4/7

    Q24-Write a program that takes radius of a circle from the user and calculates the diameter, circumference and are

    of the circle and display the result.

    Q25-There are two students Amer and Amara. We take their ages from the user, compare them and tell who is

    older?

    Q26-A shopkeeper announces a package for customers that he will give 10 % discount on all bills and if a bill

    amount is greater than 5000 then a discount of 15 %. Write a program which takes amount of the bill from user an

    calculates the payable amount by applying the above discount criteria and display it on the screen.

    Q27-Calculate the sum of even numbers for a given upper limit of integers.

    Q28-Calculate the factorial of a given number.

    Q29-Calculate the sum of odd integers for a given upper limit. Also draw flow chart of the program.

    Q30- Calculate the sum of even and odd integers separately for a given upper limit using only one loop structure.Also draw flow chart of the program.

    Q31-Create a program that allows the user to guess a character from a to z in five attempt.{ //do-while construct is

    used to allow five tries for guessing}

    Q32-Create a program that takes an integer input from user and displays its table.

    Q33-Create a program that displays the sum of squares of integers from 1 to n .

    Q34-Create a program that displays the description of a grade using switch statement.{ program gets a grade from

    user and displays a description accordingly }

    Q35- Lets consider a problem. In a company, there are deductions from the salary of the employees for a fund. Th

    deductions rules are as follows:

    i) If salary is less than 10,000 then no deductionii) If salary is more than 10,000 and less than 20,000 then deduct Rs. 1,000 as fund

    iii) If salary is equal to or more than 20,000 then deduct 7 % of the salary for fund

    Take salary input from user and after appropriate deduction show the net payable amount.

    Q36-Write a program to enter the numbers till the user wants and at the end it should display the count of positive

    negative and zeros entered

    Q37-Write a program to find the range of a set of numbers. Range is the difference between the smallest and

    biggest number in the list

    Q38-Write a program which Prints the following pattern up to 10 lines

    0

    111

    22222

  • 7/29/2019 C Language Objective 2012 Adv.docx

    5/7

    3333333

  • 7/29/2019 C Language Objective 2012 Adv.docx

    6/7

    Q39-Write a program to produce the following output:

    A B C D E F G F E D C B AA B C D E F F E D C B A

    A B C D E E D C B A

    A B C D D C B AA B C C B A

    A B B A

    A A

    Q40-Write a program which takes three sides a, b and c of a triangle input and calculates its area

    if these conditions are satisfied a+b>c, b+c>a, a+c>b

    (Help a= vs(s-a)(s-b)(s-c), where s=(a+b+c)/2

    Q41-Write a program that inputs an integer determine if it is even or odd.

    Q42-Write a program which takes a character input and checks whether it is vowel or consonant.

    Q43-According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year 1st is input throughthe keyboard write a program to find out what is the day on 1of this year.

    Q44-Write a program which takes a text input counts total number of vowels, consonants and other special

    characters and prints the result

    Q45-Write a program to make a simple calculator which should be able to do +,-,*,/,% Operations

    Q46-Write a program which takes 10 integers as input and prints the largest one.

    Q47-Write a program to finda. Surface area (A=4pr 2 )

    b. volume(v=4/3 p 3 )

    of a sphere using functions make a function for finding powers of radius.

    Q48-Write a function to compute the distance between two points and use it to develop

    another function that will compute the area of the triangle whose vertices are

    A(x1, y1), B(x2, y2), and C(x3, y3). Use these functions to develop a functionwhich returns a value 1 if the point (x, y) lines inside the triangle ABC, otherwise a value 0.

    Q49-Write a program using functions to evaluate up to 8 terms sin(x)= x - x 3 + x5 - x7 + x9 - .3! 5! 7! 9!

    Q50-Write a program that takes input for array int a[5] and array int b[5] and exchanges their values.

    Q51-Write a program that takes 10 integers as input and prints the largest integer and its location in the array.

    Q52-Write a program to copy the contents of one array into another in the reverse order.

  • 7/29/2019 C Language Objective 2012 Adv.docx

    7/7

    Q53-Write a program which takes a string as input and counts total number of vowels in that.

    Q54-Write a program to sort an integer array in descending order.

    Q55-Write a program that adds up two 4x4 arrays and stores the sum in third array.

    Q56-Write a program which takes names of five countries as input and prints them in alphabetical order.

    Q57-A 6 x 6 matrix is entered through the keyboard and stored in a 2-dimensional array mat[7][7].

    Write a program to obtain the Determinant values of this matrix

    777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777

    7777777777777777777777777777777777