1. Consider the following questions
a) Is it True or False that “Call by value” in a C function (C programming language) always return a value?
b) Based on the following:
x := 10;
y := 5;
z := x + y;
write(z);
Execution of these statements prints the value 42 on the console. Is this language Declarative or Imperative?
c) Which language processing component detects the following Java error?
int x, y;
boolean z;
z = x + y
The Preprocessor , Scanner, Parser or the Semantic Analyzer?
Answer to a)
False. There is no necessity of a function in C to return a value always. It depends upon the programmer whether the function returns a value.
Example:
#include <stdio.h>
void print(int formal_parameter)
{
printf("a = %d",formal_parameter);
}
int main()
{
int a = 10;
print(a);
return 0;
}
Output:

Answer to b)
Imperative focuses on the steps one requires to reach the desired goal or in our case output. While Declarative programming focuses on what the programmer wants as output and yes emphasis on the fact that we don't actually care what the steps are.
In this example we maintain x and y and then proceed on to do the sum and put it in z. SO we are focussing on the steps implying that the this language is IMPERATIVE.
Answer to c)
It is clearly a type mismatch between operator and operand. Which implies it a semantical error and is detected by 'SEMANTIC ANALYZER'
1. Consider the following questions a) Is it True or False that “Call by value” in...
State if each of the following statements is true or false. An assembly language is an assembly of high-level programming languages. Imperative programming paradigm is same as declarative programming paradigm. Imperative programming languages include Prolog, SQL, and XQuery. Functional programming languages include C++ and Visual C++. Each programming language is purely imperative or purely declarative or purely functional or purely object-oriented.
Answer all of the following questions:
7. (3 pts) Consider the configuration of a particle source (an oven) and 3 analyzers below. Many experimental runs are made with the source producing 400 particles (in thermalized, random states) for each run. The second analyzer is an x-direction spin analyzer, and the first and third are x,y,or z analyzers, but we don't know which kinds (they could both be the same kind). Detector A J 142) Detector B a. On average, what...
Consider the following C, C++, or Java assignment statement: value = value * 10; Assume that the variable value is declared and initialized. What are some of the bindings and their binding times for parts of the above assignment statement? Use the following bullets listing style. * * * * * * Write an example of Implicit heap dynamic variable in a selected programming language: Write an example of Stack-dynamic variable in a selected programming language:
1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true && false c. false d. False (2). You save text files containing Java language source code using the file extension___ a. .java b. .class c. .txt d. .src (3). Which of the following is not a primitive data type in the Java programming language? a. boolean b. byte c. int d. Point (4). Given the Java statement int[][] vari = new int[5][7]; the value...
A. What is the value of the following statement? Math.pow(6, 3) B. For the following code: String sentence; String str; sentence = "First exam is on Monday."; str = sentence.replace('s', '$'); C. What type of input does the following program require, and in what order must the input be provided? import java.util.*; public class Strange { static Scanner console = new Scanner(System.in); public static void main(String[] arg) { int x; int y; String name; x = console.nextInt(); name = console.nextLine();...
Please answer the following questions
1. What keyword is used to make a child class use a parent class? a.) is a b.) extends c.) has a d.) inherits 2. Suppose you have the given code below. Scanner keyboard = new Scanner(System.in); What would be the correct way to scan in an integer value from the keyboard. a.) scan.nextInt() b.) scan.nextDouble() c.) scan.nextLine() d.) keyboard.nextInt() 3. True or False. Arrays use sequential blocks of memory while linked lists do not...
CONCEPTS OF PROGRAMMING LANGUAGE Consider the following program skeleton Procedure Main is X, Y, Z: Integer; procedure Sub1 is A, Y, Z: Integer; begin -- of Sub1 ... end; -- of Sub1 procedure Sub2 is A, B, Z: Integer; begin -- of Sub2 ... end; -- of Sub2 procedure Sub3 is A, X, W: Integer; begin -- of Sub3 ... end; -- of Sub3 begin - of Main ... end; -- of Main Given the following calling sequences and assuming...
C language not C++
1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct int x; float y; char zi var1; union nt x; float y; char[20] z;) var2 f float and int are stored using 4 bytes each, what is the size (in bytes)...
NEED THIS SOON. Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P O P | P O -> + | - | * | / | ** P -> I | L | UI | UL | (E) U -> + | - | ! I -> C | CI C -> a | b | ... | y | z L -> D | DL D -> 0 | 1 | ......
Answer all of the following questions and show works:
(must show works)
Problem 1 Consider a particle in the state [4) = C( 31+z) – iV7|-z)). Note:77 ~ 2.646. a. What is the value of C? Assume C is a real, positive number. b. 1) Counter A A stream of 5000 particles, all in state 14) (from part a) enter a Stern-Gerlach analyzer as shown on the right. Counter B What will counter A read, on average? Counter C c....