This is Compilers questions.
True/False questions:
Write down the Boolean Table AND the Boolean Expression that models
the circuit that engineers two light switches A and B at the two EXITS
of a huge conference center. The specifications are as follows: (a)
Both light switches operate the one common light in the room.
(b) The light is off when both switches A and B are OFF. That would
mean that A = B = 0 implies the light is OFF = 0.
(c) Flipping either switch will turn the light ON = 1.
(d) Following (c) flipping either switch will turn the light OFF = 0.
(e) We can go back and forth between (c) and (d). Flipping either
switch A or B will turn the light OFF = 0 if it is ON = 1 and ON = 1
if it is OFF = 0.
Write a program that prints the result of rolling one fair dice.
Hint: use the rand() function with range given in arguments to generate a random integer in the desired range.
Add a loop to print the sum of rolling 10 fair dice.
Add a second loop to repeat this N times, printing the sum after each trial.
Maintain an array count[] so that count[k] stores the number of times the sum is exactly k.
Review your code and eliminate glitches and unnecessary repetitions if any.
Given three variables x, y, z write a function to circularly shift their values to right. In other words if x = 5, y = 8, z = 10 after circular shift y = 5, z = 8, x =10 after circular shift y = 5, z = 8 and x = 10. Call the function with variables a, b, c to circularly shift values.
Write a program in C to split string by space into words.
Sample Input/Output Dialog:
Input string: I am a 1st year student of BCC.
Output:
I
am
a
1st
year
student
of
CGA.
With the aid of the functions above, write a program that
a. Gets from the user the size of a data set, N.
b. Creates an array for real numbers using the value from (a) as size.
c. Uses the function from (1) to populate the array with values from the user.
d. Uses the function from (3) to get the mean, variance, and standard deviation.
e. Uses the function from (2) to display the numbers in the array (data set).
f. Displays the mean, variance, and standard deviation of the data set.
SAMPLE RUN
Enter size of data set: 5
Enter 5 numbers
2.4
-3
6
11.2
3
DATA SET
Index 4: 3.000000
Index 3: 11.200000
Index 2: 6.000000
Index 1: -3.000000
Index 0: 2.400000
Mean: 3.920000
Variance: 21.673600
Standard Deviation: 4.655491
With the aid of the functions above, write a program that
a. Gets from the user the size of a data set, N.
b. Creates an array for real numbers using the value from (a) as size.
c. Uses the function from (1) to populate the array with values from the user.
d. Uses the function from (3) to get the mean, variance, and standard deviation.
e. Uses the function from (2) to display the numbers in the array (data set).
f. Displays the mean, variance, and standard deviation of the data set.
Write a function that reads real (fractional) numbers, 𝑥1, 𝑥2, … , 𝑥𝑁 from the keyboard
into an array of N, starting from index 0. The numbers are read after a prompt.
Write a complete C program that should be able to read ten alphabets between A, B and C from users. The program should then display a list of all entered alphabets and the total number of each alphabet. You are required to write the program by applying the modular programming concept as have been taught in the class. A list (an array) to store 10 characters should be created in the main function and as part of the program, you are required to:
a) Define a function named readAlpha() to read all the 10 alphabets from the user.
b) Define a function named listAlpha() to display all the entered alphabets as a list.
c) Define a function named findTotal() to count and display the total number for each alphabet entered. Also determine which alphabet has the highest number of hit then return the result to the main function and print the result from the main function.
1.Ask user to enter three words. You can assume that each word has the maximum
length of five characters.
2. Combine the three words to form a passphrase. For example, if the user enters the
words “I”, “love” and “you”, the passphrase should be “Iloveyou”.
3. Ask user to enter a passphrase. Check whether the passphrase entered by the user is
the same as the passphrase generated in Step 2 above. If the passphrase entered is
the same, prints out “Passphrase is correct!”. Otherwise, prints out “Wrong
passphrase!”.