Given an array n integers, find and print all the unique triplets (a, b, c) in the array which give the sum K. (a+b+c=K).Input
The first line of the input will be space separated integers, denoting the elements of the array. The second line of the input will be an integer denoting the required sum KOutput
The output should be multiple lines, each line containing a unique triplet. The elements of the triple must be sorted in increasing order and all the triplets printed must be sorted in increasing order. Print "No Matching Triplets Found" if there are no triplets with the given sum.Explanation
When the given array is [0, 1, 2, 3, 5, 7, 13, 17, 19, 19] and the required sum is 22, the triplets (0, 3, 19), (0, 5, 17), (1, 2, 19), (2, 3, 17) and (2, 7, 13) have the given sum 22.
1(a) Write an algorithm/pseudocode for a movie rental company that wants to screen their customers from 18 years and above.
The system should be able to deny access to customers that appear below 18.
b. Draw a flowchart to illustrate the above program.
(a) What is the purpose of the keywords public and private in the class declaration? (b) What is the difference between a class and an object? (c) What does it mean to ‘instantiate’ an object? (d) What is the purpose of a constructor? (e) What is the difference between the default constructor and the overloaded constructor? (f) What is the purpose of a destructor? (g) What is the purpose of an accessor? (h) What is the purpose of a mutator? (i) What is the purpose of the scope resolution operator? (j) What is the difference between the scope resolution operator and the dot operator? (k) What is the difference between a member function and an ordinary function? (l) What is an abstract data type (ADT)? (m) How do we create an ADT? (n) What are the advantages of using ADTs? (o) What is separate compilation? (p) What are the advantages of separate compilation? (q) What is a derived class? (r) What is the purpose of inheritance?
Consider the following structure used to keep record of a module: struct Module { string moduleName; string moduleCode; string lecturer; int nrStudents; } Turn the Module struct into a class. The class should have member variables for all the values in the corresponding struct. Make all the member variables private. Include public member functions for each of the following: a default constructor that sets the string member variables to blank strings, and the int member variable to 0 overloaded constructor that sets the member variables to specified values; member functions to set each of the member variables to a value given as an argument to the function member functions to retrieve the data from each of the member variables Test the class in a program that instantiates an object of class Module. The program should then input values for the object and use the mutators to assign values to the member variables. Use the accessors to obtain the values
Q; Write a function to display the result of examination of students. Following requirements must be
fulfilled:
i. Read the names and marks of at least 5 students, data should be acquired from the user
and saved as dictionary (using a function named get info)
ii. Rank the top three students with highest marks (make a function named top3)
iii. Give cash rewards. Rs. 5000 for first rank, Rs. 3000 for second rank, Rs. 1000 for
third rank. Value cannot be modified (function name should be cashprize)
Write a program that uses a function to display all the numbers divisible by 3 between 0 and 100.
Q; Write a function to display the result of examination of students. Following requirements must be
fulfilled:
i. Read the names and marks of at least 5 students, data should be acquired from the user
and saved as dictionary (using a function named get info)
ii. Rank the top three students with highest marks (make a function named top3)
iii. Give cash rewards. Rs. 5000 for first rank, Rs. 3000 for second rank, Rs. 1000 for
third rank. Value cannot be modified (function name should be cashprize)
Create a form in C# Windows Form, having personal Information of the user. Name (in text box) Roll no (in text box) Session (combo box F-2017, F-2018, F-2019, F-2020, F-2021) Email (textbox) nationality (combo Box button Pakistani/ non Pakistani) Religion (Combo Box/Radio Button Muslim/ non Muslim). After entering each information everything should be displayed in listbox.
Write down the R solutions of the following question.
Use the following data to construct a confidence interval for the true mean difference between scores of two independant groups. Use a 95% level of confidence. Group1: 65, 58, 78, 60, 68, 69, 66, 70, 53, 71, 63, 63
Group 2: 62, 53, 36, 34, 56, 50, 42, 57, 46, 68, 48, 42, 52, 53, 43
Write down the R solutions of the following questions.
A shoe company wants to compare two materials, A and B, for use on the soles of boys' shoes. In this example, each of 10 boys in a study wore a special pair of shoes with the sole of one shoe made from Material A and the sole on the other shoe made from Material B. The sole types were randomly assigned to account for systematic differences in wear between the left and right foot. After three months, the shoes are measured for wear. The results are: Material A = 13.2, 8.2, 10.9, 14.3, 10.7, 6.6, 9.5, 10.8, 8.8, 13.3 Material B = 14, 8.8, 11.2, 14.2, 11.8, 6.4, 9.8, 11.3, 9.3, 13.6
Test the hypothesis H0: µdifference = 0 versus H1: µdifference≠ 0 at 95% confidence level.